In AndroidManifest.xml uses sdk means an attribute within AndroidManifest.xml

  • 2020-05-17 06:24:44
  • OfStack

In AndroidMenifest.xml, it is common to have the following statement:

 
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="10"
android:maxSdkVersion="10" />

In default.properties, you will 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's the difference between minSdkVersion, targetSdkVersion, maxSdkVersion, target API level?

minSdkVersion and maxSdkVersion are relatively easy to understand, that is, when installing the program, if the API version of the target device is smaller than minSdkVersion or larger than maxSdkVersion, the program will not be installed. 1 it is generally not necessary to set maxSdkVersion.

targetSdkVersion is a little more complicated. If this property is set, then when the program is executed, if the API version of the target device is exactly equal to this value, it will tell the Android platform that the program has been fully tested in this version and there is no problem. There is no need to turn on compatibility checking for this program. That is, if the targetSdkVersion is the same as the API version of the target device, it may be 1 more efficient.
However, this setting is only one declaration and one notification, so it does not have much practical effect. For example, if you use targetSdkVersion, a feature in SDK version, but this feature is not supported in the lower version, then when you run the program on the lower version of API device, you may report an error: java.lang.VerifyError. In other words, this property will not help you with compatibility testing. You will need to run the application through the minSdkVersion version at least once to make sure compatibility is not a problem. (it's a real headache.)

In default.properties, target refers to which version of API is used at compile time.

To sum up, the above four values are actually applied to different periods:
target API level is used at compile time to specify which version of API (SDK version) to use for compilation.
minSdkVersion and maxSdkVersion are used when the application is installed to specify which versions of the device the application can be installed on.
targetSdkVersion works while the program is running, to improve the experience of running the program on a given version of the device.

These four values are not strictly checked when the program is compiled. For example, if you set minSdkVersion to be larger than maxSdkVersion, it will automatically ignore the wrong maxSdkVersion.

Addition: this site also provides an online query form about Android Manifest functions and permissions for your reference:

Android Manifest function and authority description daqo:

http://tools.ofstack.com/table/AndroidManifest


Related articles: