Reputation: 1199
I have a question about android sdks. I'm developing an android application and it must be work on Android 2.3.3 and higher.
Because I need to use "android-support-v7-appcompat" library, I need to compile the project with Android 4 or higher. If I try to compile with Android 2.3.3, the project doesn't compile.
So what happens if I compile the project with Android 4? Would it work on Android 2.3.3?
Of course I would set in AndroidManifest.
Upvotes: 2
Views: 973
Reputation: 12435
In any case you should properly define minSDK and targetSDK in manifest file. When you compile for example with API 19 (KitKat) and you set as minSDK API 10 everything should work on your 2.3.3 Android.
However if you used in your code some methods, constants that are not available on 2.3.3 you will get warnings/errors in Eclipse (I bet in Android Studio as well). For example:
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
// before JELLY_BEAN_MR2 code;
// methods, constants available for example from API 1
} else {
// after JELLY_BEAN_MR2 code
// here are new methods,constants available from GINGERBREAD_MR1 and after
}
so here your app will execute something in a two different way depending on Android version it is running on... In case you don't compile with API equals or higher of JELLY_BEAN_MR2 you would not even be able to compile because before, constant JELLY_BEAN_MR2 was not available in API... However when you compile with higher API everything will be compiled properly and app will work on earlier versions without problems.
If you leave code like this warning will appear but @SuppressLint("NewApi") before calling method should remove it with no further problems.
Hope it helped and it is clear now.. ;)
Cheers
Upvotes: 1
Reputation: 757
Its Depends on your target selected for ex:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
Upvotes: 0