简体   繁体   中英

Android Development, SDK Version

First time developing for Android.

I've noticed that the latest SDK is v4.x but I've noticed informally that most people are running v2.3

If I develop an app using the 4.x SDK. will it refuse to run on 2.3 phones? Or will certain features be disabled?

Should I develop using the 2.3 SDK instead?

Before answering the question, something should be cleared up: There's a difference between the version of Android (2.3, 4.x, etc) and the version of the API it runs on (which is ALWAYS an integer: 10,11,12, etc). The relationship between Android platforms and their respective API versions can be found on this page . By way of example, Android 2.3 uses API 10, and Android 4.0 uses API 15.

Furthermore, there's only one SDK, which has downloadable modules for coding against various versions of the API. So it's not that you're using v4.x of the SDK, it's that you're using the SDK, period, and coding against version 15 of the API :).

That said: The best thing to do is set minSdkVersion to the minimum version of Android your application will run on, and set targetSdkVersion to the most current version of Android. Then you can use Build.VERSION_CODES to check for new versions of the platform at runtime, and activate new platform features as necessary. A good tutorial on how to do this is on the Android Developer blog, titled How to have your cupcake, and eat it too .

I would even recommend targeting 2.2 as I still have a large number of users (16%) running Android 2.2. Here is a break down of on one of my apps that shows what version users are currently running. ( See attached picture ). Like J. Maes said the lower you can build it the more users you can capture. Although there are trade-offs that you will have to make by using an older SDK. For most purposes I haven't had much of an issue targeting 2.2. It allows me access to a larger customer base.

You should use the lowest version that supports all the features you want to use in your app. If you think a 4.x feature is absolutely necessary in you app, then you should use it. If not, use 2.3, so more people can run it as Android is backwards compatible.

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