Saturday, 7 April 2012

Android: Project build target vs minSdkVersion

Project build target is the SDK version you build your app with. minSdkVersion is the minimum SDK version you want your app to run on.

You want to build your app with latest SDK since it may contain bug fixes not available in older SDK, but you can still run your app on an older SDK. For example, you can set project build target to be 15 (Android 4.0) but set minSdkVersion to be 8 (Android 2.2).

You set project build target by right click your project and choose "properties", then go to "Android" and select "Project build target".

You set minSdkVersion by setting  <uses-sdk android:minSdkVersion="x" />  in AndroidManifest.xml, before application node.

2 comments:

  1. I was playing around with changing my current Project Build Target from 2.3.3 to 4.0.3.

    I got a bunch of deprecated warnings.

    Is that pretty normal?
    If I correct all these deprecated warnings will the code still work for minSdkVersion-4?

    I like the idea of being current for the bug fixes but I'm just a little worried about things breaking.

    ReplyDelete
  2. I think correcting the deprecated warnings may cause problem since the newer functions may not exist in an earlier API level. You may need to increase your minSdkVersion to an API level which supports the newer functions.

    ReplyDelete