Can i run Android 2.0 application in Android 1.5?
I developed one simple android application targeting the Mobiles with android 2.0 OS.I want to know whether i can run the same applicat开发者_开发知识库ion in android 1.5 .If any body knows it please help me out.
In your AndroidManifest.xml file (located in the base of the project) there's a tag called uses-sdk
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
Those numbers are known as API level where 3 is for Android 1.5 and 5 is for Android 2.0.
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Note that this allows you to compile your code against the 2.0 SDK but if you use classes or functionality in your app that is not supported in 1.5 then it will crash. I recommend that you create an AVD for 1.5 and 1.6 for testing.
You may want to consider just compiling against 1.5 for simplicty.
Lastly, a common trick is to compile against 2.0 and avoid/disable features that aren't supported in earlier versions of android the following article shows how do this.
http://developer.android.com/resources/articles/backward-compatibility.html
精彩评论