Uses-sdk attribute meaning in AndroidManifest. xml

Source: Internet
Author: User

In AndroidMenifest. xml, the following statements are often used: Copy codeThe Code is as follows: <uses-sdk android: minSdkVersion = "4"
Android: targetSdkVersion = "10"
Android: maxSdkVersion = "10"/>

In default. properties, the following statement is displayed:
Target = android-10
If you are using Eclipse, you may also see the following warning:
Attribute minSdkVersion (4) is lower than the project target API level (10)

So what are the differences between the minSdkVersion, targetSdkVersion, maxSdkVersion, and target API level values?

MinSdkVersion is easier to understand than maxSdkVersion. When installing a program, the program cannot be installed if the API version of the target device is earlier than minSdkVersion or later than maxSdkVersion. Generally, you do not need to set maxSdkVersion.

TargetSdkVersion is relatively complex. If this attribute is set, the Android platform will be notified if the API version of the target device is equal to this value during program execution: this program has been fully tested in this version and is no problem. You do not have to enable the compatibility check for this program. That is to say, if the targetSdkVersion is the same as the API version of the target device, the running efficiency may be higher.
However, this setting is only a declaration and a notification, and does not have a very substantial effect. For example, a feature in the targetSdkVersion SDK version is used, however, this feature is not supported in earlier versions. When you run a program on an API Device of earlier versions, the following error may be reported: java. lang. verifyError. That is to say, this attribute will not help you solve compatibility testing problems. You must at least run the program completely in minSdkVersion to ensure compatibility. (This problem is really a headache)

In default. properties, the target indicates the version of the API used for compiling.

In summary, the above four values actually apply to different periods:
The target API level is used during compilation to specify the API version (SDK version) used for compilation.
MinSdkVersion and maxSdkVersion are used when a program is installed. They are used to specify which versions of devices can install the application.
TargetSdkVersion is used to improve the running experience of devices of the specified version when the program is running.

These four values are not strictly checked during program compilation. For example, if you set minSdkVersion to be greater than maxSdkVersion, the system automatically ignores the wrong maxSdkVersion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.