Differences between minsdkversion, targetsdkversion, and targetapilevel

Source: Internet
Author: User

In androidmenifest. XML, the following statements are often used:
<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.ProgramIf the API version of the target device is earlier than minsdkversion or later than maxsdkversion, the program cannot be installed. 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.