简体   繁体   中英

What value to set for: “Minimum Required SDK” , “Target SDK” & “Compile with”

I know that there are many question on this, and I also read this page . However, I am still confused about the exact choices.

If I have a mobile phone that runs Android 2.3.6

I know that the Minimum Required SDK should be the lowest version of Android that my app supports. So for example I will choose Android 2.2 or less than that value, say Android 1.5


The confusing parts Target SDK and Compile with

I have installed these below: (there is no Android 2.3.6 available in the SDK manager)

Android 4.2.2 (API 17)
Android 3.0 (API 11)
Android 2.3.3 (API 10)
Android 2.2 (API 8)

Is the Target SDK should be set to the maximum which is Android 4.2.2 , irrespective to what my mobile phone uses; which is Android 2.3.6 ?

choosing Android 4.2.2 will cover all phones below it? is that right?

Or

Is it should be set to the exact/nearest value as my phone. Here the available one is Android 2.3.3 ? But not exceed my mobile phone Android 2.3.6


Is Compile with must be set to the maximum Android 4.2.2 or what?

Is the Target SDK should be set to the maximum which is Android 4.2.2, irrespective to what my mobile phone uses; which is Android 2.3.6 ?

That is up to you, but its always recommended to use the latest sdk as a target.

It just says that the application will work between min and target sdk, but tested for the target sdk alone, so if there are any compatible settings system must take care of it.

choosing Android 4.2.2 will cover all phones below it? is that right?

Your app always covers from Min-SDK to Max-SDK. If the Min-SDK is 1 and Max-SDk is not set, then your app supports all the APIs.

Is it should be set to the exact/nearest value as my phone. Here the available one is Android 2.3.3? But not exceed my mobile phone Android 2.3.6

Must be the latest SDK

Is Compile with must be set to the maximum Android 4.2.2 or what?

Its just your choice of which SDK to compile your app with. But better go with the Target-SDK which in turn is the Latest.

I've always set my Compile with to the be same as Target SDK .

Target should be what you have tested and architected your app to handle. As Android evolves API behaviors can change, like the Serial/Parallel/Serial nature of default AsyncTask (see: Running multiple AsyncTasks at the same time -- not possible? and http://commonsware.com/blog/2012/04/20/asynctask-threading-regression-confirmed.html ) which depended on your app's Target API and on the device API. Fun times for us discovering it then.

In addition various APIs get depreciated as well so going with the most recent API forces you to only use what being currently maintained.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM