2012年3月3日 星期六

[AndroidManifest] uses-sdk

android:minSdkVersion
  • An integer designating the minimum API Level required for the application to run.
  • The Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute.
  • Default value of "1", which indicates that your application is compatible with all versions of Android.
  • The application will crash during runtime when attempting to access the unavailable APIs.

android:targetSdkVersion
  • An integer designating the API Level that the application targets.
  • Default value equals that given to minSdkVersion.
  • This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version.
  • The application is still able to run on older versions (down to minSdkVersion).
  • The system may enable compatibility behaviors to ensure when system API level > target.
  • For example, 
    • setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher
    • disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens).
  • There are many compatibility behaviors that the system may enable based on the value you set for this attribute.
  • 也就是說,在執行時起作用,如果版本相同時,效率可能會高點。

android:maxSdkVersion
  • An integer designating the maximum API Level on which the application is designed to run.
  • In Android 1.5, 1.6, 2.0, and 2.0.1, the system checks the value of this attribute when installing an application and when re-validating the application after a system update.
  • In the case of re-validation after system update, this effectively removes your application from the device.
  • Declaring this attribute is not recommended.
    • By design, new versions of the platform are fully backward-compatible.
    • Declaring the attribute can result in your application being removed from users' devices after a system update to a higher API Level.
  • Future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation. 
    • Google Play will continue to use the attribute as a filter, however, when presenting users with applications available for download.

target API level
指定要 compiler 的 API 版本。


* Reference
- uses-sdk
- minSdkVersion、targetSdkVersion、targetApiLevel的区别

沒有留言:

張貼留言