[Android] Android weekly topic in maxSdkVersion, minSdkVersion, targetSdkVersion, as well as the target project.properties

This series of articles are A2BGeek original, reproduced sure to clearly indicate at:

[Reprinted from A2BGeek of Android thematic weekly] series, the original link: http://blog.csdn.net/a2bgeek/article/details/8203583

maxSdkVersion and minSdkVersion

1、maxSdkVersion

When the program is installed, if the API version of the target device is greater than maxSdkVersion, the program will not be installed; some programs will need to check before or after the upgrade phone OTA upgrade, if the program is maxSdkVersion less than the current API version of the phone, it will be deleted . The original words of the official document is: an In either Case, IF at The the Application's maxSdkVersionattribute IS Lower Within last at The API Level Used by at The System Itself, the then at The System by Will not the allow at The the Application to BE Installed an In at The Case of Re-Validation the After System Update,. this effectively removes your application from the device .

Careful developers may find, after upgraded SDK (mine is 4.3 SDK), the new application has been created without this attribute, and why?

First, the new version of the system is fully backward compatible, you do not need to set this property to stop your program is installed on the new platform. http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels

Secondly, if you specify this attribute, then the user's mobile phone may be deleted after you upgrade your application.

2, minSdkVersion

When installing the program, if the API version of the target device is less than minSdkVersion, the program will not be installed. Official documents are the original words: 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.

targetSdkVersion

We first need to explain the compatibility issues.

First, forward-compatible

为老版本系统开发的程序,在新版本的系统上同样可以运行。因为most changes in the APIare additive and introduce new or replacement functionality. As parts of the APIare upgraded, the older replaced parts are deprecated but are not removed, sothat existing applications can still use them. In a very small number of cases,parts of the API may be modified or removed, although typically such changes areonly needed to ensure API robustness and application or system security. Allother API parts from earlier revisions are carried forward withoutmodification.

The following measured about backward compatibility, I use the 2.3 SDK to compile, can run on a 4.3 system, but the appearance and the appearance of under 2.3 system (which is the reason Theme using 2.3 compiler is unable to use HOLO theme), We can see the three points is forward-compatible results on the right side of the navbar (menu):

Second, backward compatibility

And forward compatibility is defined as similar, but if the program uses the old version of the system does not have the API, it is not run on older versions of the system. Then what should be done? Can refer to this article http://android-developers.blogspot.com/2010/07/how-to-have-your-cupcake-and-eat-it-too.html

The following is targetSdkVersion

Take, for example the first (A target device is running Android4.3 system, the compiler uses android-18):

1, create a new project, targetSdkVersion defaults to 18


2, modify targetSdkVersion 10

Careful readers will find at the bottom right of the navbar, more than a menu button.

Here's what targetSdkVersion meaning.

targetSdkVersion is forward-compatible control behavior. Note compatible behavior refers only to appearance rather than function (Theme), take the menu, if specified targetSdkVersion 10 tells the system to use the program features to run under 2.3, 2.3 there is a menu, so the system is added to the right side of the navbar a menu button. That targetSdkVersion can deactivate forward-compatible behavior as targetSdkVersion is displayed as 18.

The target project.properties

api version specifies the use of compile time, changed the words of your project android.jar will also change, while applying some of the topics will also be affected.

in conclusion:

minSdkVersion, when maxSdkVersion installation work

When running targetSdkVersion work

project.properties the target compile time work

References:

Published 11 original articles · won praise 2 · views 10000 +

Guess you like

Origin blog.csdn.net/zhengyin_tmac/article/details/52085370