Android Compilesdkversion, Minsdkversion, and Targetsdkversion

Source: Internet
Author: User

During the year, it is also possible just a few months later that you will post your Android app. But there is a possibility of releasing a new version of the Android system, such as: 6.0+.

You certainly want your app to be forward compatible, and when users upgrade to a new Android system, the system APIs your app calls will not compile or crashing.

This is the time to consider three parameters:compilesdkversion, minsdkversion, and targetsdkversion (They identify what version of the API can be used , apply a compatible version, compile the required API version)

Compilesdkversion

Tell Gradle which version of the SDK to use to compile your app, and if you use a higher version of the API, you'll need to set compilesdkversion to a higher version of the API. It should be noted that changing the compiled version does not change the presentation of the application runtime, but new warnings or errors may appear. Compilesdkversion will not be included in your app, it's just a purely compiled app. Therefore, the best solution is to fix the errors and warnings that are encountered during compilation.

It is highly recommended to set your compilesdkversion to the latest, compile your app with the latest SDK, check the latest SDK's impact on existing code, avoid outdated APIs, and prepare to use the latest APIs, which will make your app more robust in terms of compatibility.

It is important to note that if you use the support library, you must compile with the latest SDK, for example, in order to use the 23.1.1 support library, your build version is at least 23 (the first digit must match), and in general, the new support The Library release will be accompanied by a platform version for better compatibility.

Minsdkversion

If the compiled version is set up with the latest APIs, then your minsdkversion will need to set up a version with the latest APIs. Minsdkversion is the Google Play store used to determine if your app can be installed on those devices. That is, the minimum version of your app is compatible, and for developers, when you use lint to check your app, you'll be prompted which APIs are incompatible with the minimum version (Minsdkversion), and you'll be using different APIs depending on the version of the system. To avoid the various unexpected crashing encountered during the operation.

Be sure to keep in mind the third-party libraries you use, such as support Libraries Orgoogle Play Services, whether the minsdkversion supported by them conflict with your app, and adjust your minsdkversion based on them, or in order to be compatible with your minsdkversion, and to determine the different system versions to use third-party libraries, both of which, of course, if you want to use a high version of the library if you are not compatible with the lower version, then you need to use tools:overridelibrary marker, To set a more detailed androidmainfest.xml.

Targetsdkversion

Targetsdkversion is the primary way Android provides forward compatibility. The best way is to set it up up to date.

The relationship between three persons:

Minsdkversion <= targetsdkversion <= compilesdkversion

The ideal relationship should be this:


Targetsdkversion = = compilesdkversion (latest SDK)


Android Compilesdkversion, Minsdkversion, and Targetsdkversion

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.