简体   繁体   中英

Android, is it possible to set project build target and minimum SDK Version differently?

When you want to create project through wizard, it asks you enter Project Build Target. Assume that

  1. I want my application to support Android 2.1 and above,
  2. My test devices are a hand phone with Android 2.3.3 and a tablet 7" with Android 3.2.
  • Is it mandatory to choose "Android 2.1 (API level 7)" in Project build target?
  • May I set Project Build Target to "Android 4.0.3 (API level 15)"

Manifest:

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>

Yes, the project build target SDK version may be higher (but not lower obviously) than the minimum SDK version specified in the Manifest. Just make sure to avoid calling APIs that came in with higher SDK versions than the minimum you specified.

Yes you can. The targetSdkVersion helps the device with higher API level to use the newest (optimized) version of the implementation rather than the default implementation of the minSDKVersion and prevent enabling the compatibility behaviors. Make sure you test on device running this version though.

Ref: targetSdkVersion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM