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.