2

I had made an application with target : Android 2.1 - API Level7. It works fine with the emulator with target : Android 2.1 - API level7. And after that i tried to run the same app in an emulator with target : Android 1.5 - API Level3. But it is not working. I am using the Eclipse to built my application..

Can anyone say why it happens like this? Or, can anyone simply describe how to make changes to run an app build in API Level7 to 5 with steps.. I am new to this environment, i may be wrong with my procedures..

So plz guide me..

Dil Se...
  • 877
  • 4
  • 16
  • 43
  • Read more about SDK versions here: http://stackoverflow.com/questions/4568267/android-min-sdk-version-vs-target-sdk-version – Flo Jan 17 '12 at 08:44

4 Answers4

3

Use the min sdk version in your manifest file to Android 1.5 api level 3. Your api target version is still the same.

Add the following line in your AndroidManifest.xml file

<uses-sdk android:minSdkVersion="3" />

this will allow your app to run in any device with api level 1.5 or higher.

Dinesh Sharma
  • 11,533
  • 7
  • 42
  • 60
0

Set the minSDK to the lowest level you want to support, and the max to the highest level. The set the target to whichever makes sense.

In summary, look at this: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html.

You choose the min, target and max SDK in the manifest file.

AJcodez
  • 31,780
  • 20
  • 84
  • 118
  • 3
    Never set the maxSDK variable when you don't have a good reason to. Otherwise you have to rebuild and republish you app every time a new Android version is released. – Flo Jan 17 '12 at 08:40
  • You're 100% right I meant if you only want to support up to a certain level but I should have been clearer. – AJcodez Jan 17 '12 at 09:07
0

android is backwards compatible, not forwards, so your target api should be the lowest version of android ynu would like your app to run on. your target api should be 1.5.

J. Maes
  • 6,862
  • 5
  • 27
  • 33
0

Yes as everyone said. Android minimum-sdk-version is trick for you question.

If you have target API 2.3.3 then minimum-sdk-version will be 10(By default).so it will run on 2.3.3, 3.1,3.3 and more which has minimum-sdk-version more than 10.

So if i change minimum-sdk-version to 4 it will work on device which have version more than 4.

No you have two solution --

1) change minimum-sdk-version in android-manifest

2) change target api

 project->rightclick->properties->android then select Target API
Tofeeq Ahmad
  • 11,935
  • 4
  • 61
  • 87