Wowzer Wowzer - 3 months ago 9
Android Question

What should I set for compileSdkVersion, minSdkVersion, and targetSdkVersion?

I am concerned about what should I set the

compileSdkVersion
,
minSdkVersion
, and
targetSdkVersion
to be.


  1. My concern first of all is that if I set the
    compileSdkVersion
    to be 23 which is the latest right now, will older device be able to run it?

  2. How do I exactly know what should my
    minSdkVersion
    be in order to make sure that phone running lower api or version be unable to access it (I don't want to set the minimum sdk too high because that would block phone that could potentially run the app)?

  3. How should I set my
    targetSdkVersion
    ?


Answer

I set the compileSdkVersion to be 23 which is the latest right now, will older device be able to run it?

Yes. compileSdkVersion on its own has nothing to do with what devices can and cannot run your app. Usually, you set this to be the latest version of the Android SDK.

How do I exactly know what should my minSdkVersion be in order to make sure that phone running lower api or version be unable to access it?

Frequently, the development tools will warn you on the fly when you try using something that is newer than your minSdkVersion. You can run a full Lint check to reconfirm periodically.

How should I set my targetSdk?

In the absence of any particular reason to choose something else, I usually pick the latest or next-to-latest value at the time I create my project (e.g., 22 or 23 now). targetSdkVersion helps with backwards compatibility, and usually my description is "it's the version of Android that you were thinking of at the time you were writing the code".