Supporting both 1.5 and 1.6?

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Supporting both 1.5 and 1.6?

Postby limtc » Mon Nov 02, 2009 10:03 am

Hi,
I just got myself an Android phone running 1.6 with 240x320 screen.
This required me to use 1.6, but I wish to support 1.5 too.

According to http://d.android.com/guide/practices/sc ... pport.html
(Strategies for Legacy Applications):

--
Change your application's build properties, such that it compiles
against the Android 1.6 (API Level 4) library, rather than against the
Android 1.5 (or earlier) library. You will not be able to compile your
application against the older platform because of the new manifest
attribute.
...
Set up AVDs for testing your application on Android 1.5 (or earlier
platform). You need AVDs running the older platforms you are
targeting, so that you can test for compatibility and ensure that
there are no functional regressions.
Compile your application against the Android 1.6 library and run it on
the AVDs you created. Observe the way your application looks and runs,
and test all of the user interactions.
--

However, how does it work? Now my codes cannot compile on a 1.5
device, nor does the AVD 1.5 even shown up in the target list! How do
you "run it on the AVDs you created"?

Thanks!
limtc
Freshman
Freshman
 
Posts: 8
Joined: Wed Sep 23, 2009 4:20 am

Top

Postby Oleg » Mon Nov 02, 2009 11:52 am

Hi.

Hmm. Interesting problem.
Did you try to put this code in manifest
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"
android:anyDensity="false" />
<uses-sdk android:minSdkVersion="3" android:maxSdkVersion="4" android:targetSdkVersion="4" />
Also create 2 avd for 1.5 and 1.6
Here explanation
http://thedevelopersinfo.wordpress.com/ ... ices-avds/

After install application to the both emulator instances and test it.
http://thedevelopersinfo.wordpress.com/ ... -emulator/

Hope it will useful.
My applications works correct in 1.5 and 1.6. Also for 1.6 they works for multiple screen resolutions.
Oleg
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Wed Nov 28, 2007 1:49 pm
Location: Ukraine

Postby limtc » Mon Nov 02, 2009 11:57 am

Oleg wrote:Hi.

Hmm. Interesting problem.
Did you try to put this code in manifest
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"
android:anyDensity="false" />
<uses-sdk android:minSdkVersion="3" android:maxSdkVersion="4" android:targetSdkVersion="4" />
Also create 2 avd for 1.5 and 1.6
Here explanation
http://thedevelopersinfo.wordpress.com/ ... ices-avds/

After install application to the both emulator instances and test it.
http://thedevelopersinfo.wordpress.com/ ... -emulator/.


Hi yes.

The main problem started from the part you stated "after install application to the both emulator instances..." - how? The AVD 1.5 does not appeared and cannot be selected when compiled. Only 1.6 shows and worked.

Thanks for any help provided.
limtc
Freshman
Freshman
 
Posts: 8
Joined: Wed Sep 23, 2009 4:20 am

Postby Oleg » Mon Nov 02, 2009 1:23 pm

Don't try to use in this step IDE.
Did you have 2 AVD one for 1.5 other for 1.6.
Start avd for 1.5 Android from command line
emulator -avd myAvd1.5
Emulator is working then install application from command line also
adb install C:/release/bin/application.apk
This command will install your application to myAvd1.5.

The same steps for 1.6

Feel free to ping me if you will have problem :)
Oleg
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Wed Nov 28, 2007 1:49 pm
Location: Ukraine

Postby limtc » Mon Nov 02, 2009 1:48 pm

Oleg wrote:Don't try to use in this step IDE.
Did you have 2 AVD one for 1.5 other for 1.6.
Start avd for 1.5 Android from command line
emulator -avd myAvd1.5
Emulator is working then install application from command line also
adb install C:/release/bin/application.apk
This command will install your application to myAvd1.5.

The same steps for 1.6

Feel free to ping me if you will have problem :)


Oh... so it is Eclipse which has issue.

Can we do it in a real 1.5 device rather than AVD? Since I cannot compile to a 1.5 ACD anyway...
limtc
Freshman
Freshman
 
Posts: 8
Joined: Wed Sep 23, 2009 4:20 am

Postby Oleg » Mon Nov 02, 2009 2:05 pm

limtc wrote:Oh... so it is Eclipse which has issue.

Can we do it in a real 1.5 device rather than AVD? Since I cannot compile to a 1.5 ACD anyway...


Yes you can. If you have real device.
But if you want to test on emulator I will explain more detailed.
You only need to create 2 emulator instances (AVDs).
You don't need to compile application for 1.5 and 1.6. You compile application once. If you need to compile application then click in Eclipse Project->Clean.

If you have android 1.6 SDK:
Create:
android create avd -n my1.5 -t 1
android create avd -n my1.6 -t 2

Run 1.5
emulator -avd my1.5

Install application:
adb install D:/application/My.apk

Test it.

Run 1.6
emulator -avd my1.6

Install application:
adb install D:/application/My.apk

Test it.

Copy these code snippets to your system and use them.

As you see these operations are simple.

Note: you need only once compile application. It compiles by default for 1.5 and 1.6
Oleg
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Wed Nov 28, 2007 1:49 pm
Location: Ukraine

Top

Postby limtc » Mon Nov 02, 2009 2:39 pm

Oleg wrote:Run 1.5
emulator -avd my1.5

Install application:
adb install D:/application/My.apk


Note: you need only once compile application. It compiles by default for 1.5 and 1.6


Mmm... as a Mac users, I am still quite confuse and looking for a faster way (since currently I just compiled and it shows up on the 1.5 device).

I assume you create the apk by "Export Unsigned Application Package"?

adb cannot found, so I go learn some command prompt and put the path in .profile. Then I try to install, and I got:

Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

So I have to created signed package instead (that will be troublesome if have to do everytime).

What do you mean by "only once compile application"? Or is the apk file is already there? I don't understand... and if possible, try not to use command prompt.

Thanks!
limtc
Freshman
Freshman
 
Posts: 8
Joined: Wed Sep 23, 2009 4:20 am

Postby Oleg » Mon Nov 02, 2009 3:27 pm

limtc wrote:Mmm... as a Mac users, I am still quite confuse and looking for a faster way (since currently I just compiled and it shows up on the 1.5 device).

I assume you create the apk by "Export Unsigned Application Package"?

adb cannot found, so I go learn some command prompt and put the path in .profile. Then I try to install, and I got:

Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

So I have to created signed package instead (that will be troublesome if have to do everytime).

What do you mean by "only once compile application"? Or is the apk file is already there? I don't understand... and if possible, try not to use command prompt.

Thanks!


At first: it is very good that your application works on the 1.5
At second: I use "Export unsigned..." only when prepare application for production. Eclipse always compiles application and creates apk file in your_application_workspace/Application/bin/Application.apk. If you want to generate it manually then go in Eclipse Project->Clean
At third: Try to uninstall application and after re-install it
At fourth: "only one..." I mean that your apk is ready for deployment to the 1.5 and 1.6. Don't need to compile it for 1.5 and 1.6 separately.

If your will have problem with this after uninstalling and re-installing application try to go to the Settings->Applications->check Unknown Sources in your emulator/device

I don't know any other ways. I use command line. Need to investigate other ways.
Oleg
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Wed Nov 28, 2007 1:49 pm
Location: Ukraine

Postby limtc » Mon Nov 02, 2009 4:18 pm

Oleg wrote:At first: it is very good that your application works on the 1.5
At second: I use "Export unsigned..." only when prepare application for production. Eclipse always compiles application and creates apk file in your_application_workspace/Application/bin/Application.apk. If you want to generate it manually then go in Eclipse Project->Clean
At third: Try to uninstall application and after re-install it
At fourth: "only one..." I mean that your apk is ready for deployment to the 1.5 and 1.6. Don't need to compile it for 1.5 and 1.6 separately.

If your will have problem with this after uninstalling and re-installing application try to go to the Settings->Applications->check Unknown Sources in your emulator/device

I don't know any other ways. I use command line. Need to investigate other ways.


Thanks! I learned a lot today. I will give these advices a test.

Currently I am doing the stupid way - keep switching between 1.5 and 1.6 (then add in the targetSDK) to test between both devices...
limtc
Freshman
Freshman
 
Posts: 8
Joined: Wed Sep 23, 2009 4:20 am

Dont want to show my app in 320x480 Screen - Normal Screen

Postby saamyandroid » Fri Jan 22, 2010 7:56 am

I want to filter my application in Android market.

I developed my Games only to 320x480 Screen - Normal Screen Mobiles like HTC Hero ,HTC Magic etc.

So i dont want to show my games for Small and Large Screen Mobiles in android market.

I used Following in Manifest.

<uses-sdk android:minSdkVersion="2" android:targetSdkVersion="4"/>
<supports-screens
android:largeScreens="false"
android:normalScreens="true"
android:smallScreens="false"
android:anyDensity="false">

is this is correct?


i have only android Developer Phone 1.

so just to check
i used

<uses-sdk android:minSdkVersion="2" android:targetSdkVersion="4"/>
<supports-screens
android:largeScreens="false"
android:normalScreens="false"
android:smallScreens="true"
android:anyDensity="false">


To Filter my game only to Small Screen (240x320) dont want to show other screens like Normal (320x480) Large Screen (480x854).

But Android market still(But I Filtered only to small screen ) showing Apps in my Android Develoepr phone 1(Normal Screen).


Any help is appreciated,
Thanks in Advance,
saamyandroid
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Sep 09, 2009 8:17 pm
Location: INDIA

Re: Dont want to show my app in 320x480 Screen - Normal Scre

Postby limtc » Fri Jan 22, 2010 8:01 am

saamyandroid wrote:
<uses-sdk android:minSdkVersion="2" android:targetSdkVersion="4"/>
<supports-screens
android:largeScreens="false"
android:normalScreens="false"
android:smallScreens="true"
android:anyDensity="false">


I believe the filtering only applied to small screen. For normal/large screen this only affect the compatibility mode, the Market will always show them.
limtc
Freshman
Freshman
 
Posts: 8
Joined: Wed Sep 23, 2009 4:20 am

Re: Dont want to show my app in 320x480 Screen - Normal Scre

Postby saamyandroid » Fri Jan 22, 2010 8:28 am

I believe the filtering only applied to small screen. For normal/large screen this only affect the compatibility mode, the Market will always show them.



ok but if i set it for Large Screen ,

it should not display in normal and small screen.Right?

it still displaying in normal screen.
saamyandroid
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Sep 09, 2009 8:17 pm
Location: INDIA

Dont want to show my app in 320x480 Screen - Normal Screen

Postby saamyandroid » Fri Jan 22, 2010 8:57 am

I want to filter my application in Android market.

I developed my Games only to 320x480 Screen - Normal Screen Mobiles like HTC Hero ,HTC Magic etc.

So i dont want to show my games for Small and Large Screen Mobiles in android market.

I used Following in Manifest.

<uses-sdk android:minSdkVersion="2" android:targetSdkVersion="4"/>
<supports-screens
android:largeScreens="false"
android:normalScreens="true"
android:smallScreens="false"
android:anyDensity="false">

is this is correct?


i have only android Developer Phone 1.

so just to check
i used

<uses-sdk android:minSdkVersion="2" android:targetSdkVersion="4"/>
<supports-screens
android:largeScreens="false"
android:normalScreens="false"
android:smallScreens="true"
android:anyDensity="false">


To Filter my game only to Small Screen (240x320) dont want to show other screens like Normal (320x480) Large Screen (480x854).

But Android market still(But I Filtered only to small screen ) showing Apps in my Android Develoepr phone 1(Normal Screen).


Any help is appreciated,
Thanks in Advance,
saamyandroid
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Sep 09, 2009 8:17 pm
Location: INDIA

Postby icobasco » Wed Jan 27, 2010 9:11 pm

Oleg wrote:
limtc wrote:...
I don't know any other ways. I use command line. Need to investigate other ways.


When you deploy the app on the device, click con Run/Run Configuations.
In the popup window, find your "Android Application" and in the "Target" tab check "Manual" in the "Deployment Target Selection Mode". So every time you run (by the green play) your app, a popup ask you where to deploy it, giving you a list of living and connected emulators/devices and a list of possible new ones as you created before.

Hope this helps :)
User avatar
icobasco
Senior Developer
Senior Developer
 
Posts: 108
Joined: Thu Jun 04, 2009 11:12 am
Location: Italy

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 2 guests