The difference between minsdkversion, targetsdkversion and Targetapilevel

Source: Internet
Author: User

in Androidmenifest.xml, there are often the following statements:

<USES-SDK android:minsdkversion= "4"
Android:targetsdkversion= "10"
android:maxsdkversion= "Ten"/>

In Default.properties, you see the following statement:
Target=android-10

If you're using Eclipse, you might also see a warning like this:
Attribute Minsdkversion (4) is lower than the project target API level (10)

So, what is the difference between the minsdkversion, Targetsdkversion, maxsdkversion, target API level four values in this?

Minsdkversion and maxsdkversion are easier to understand, that is, when installing the program, if the target device API version is less than minsdkversion, or greater than maxsdkversion, the program will not install. It is generally not necessary to set maxsdkversion.

Targetsdkversion is relatively complex, if this property is set, then when the program executes, if the target device API version is exactly equal to this value, he will tell the Android platform: This version of the program has been fully tested, no problem. It is not necessary to turn on compatibility check for this program. That is, if the targetsdkversion is the same as the API version of the target device, it may be more efficient to run.

However, this setting is just a declaration, a notification, and will not have a substantial effect, for example, using the Targetsdkversion version of the SDK is a feature, but this feature is not supported in the lower version, then run the program on the lower version of the API device, May be error: Java.lang.VerifyError. That is, this property does not help you resolve the compatibility test problem. You need at least a complete run of the program on Minsdkversion this version to determine compatibility is no problem. (That's a real headache.)

The target in default.properties refers to which version of the API is used for compiling at compile time.

In summary, the above four values are actually acting on different periods:
The target API level is used at compile time to specify which API version (SDK version) to use for compiling.
Minsdkversion and maxsdkversion are used when the program is installed to specify which versions of the device can install the app.
Targetsdkversion is useful when the program is running to improve the program run experience on a specific version of the device.

These four values are not strictly checked in the program compile, for example, you can set minsdkversion more than Maxsdkversion, he will automatically ignore the wrong maxsdkversion.


The difference between minsdkversion, targetsdkversion and Targetapilevel

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.