Late to the game.. and there are several great answers above-- essentially, that the compileSdkVersion
is the version of the API the app is compiled against, while the targetSdkVersion
indicates the version that the app was tested against.
I'd like to supplement those answers with the following notes:
targetSdkVersion
is 23 or higher, the app requests permissions from the user at run-time.targetSdkVersion
is 22 or lower, the system asks the user to grant the permissions when the user installs the app.If the compileSdkVersion
is higher than the version declared by your app's targetSdkVersion
, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. (ref)
With each new Android release...
targetSdkVersion
should be incremented to match the latest API level, then thoroughly test your application on the corresponding platform versioncompileSdkVersion
, on the other hand, does not need to be changed unless you're adding features exclusive to the new platform versiontargetSdkVersion
is often (initially) less than than the compileSdkVersion
, it's not uncommon to see a well-maintained/established app with targetSdkVersion > compileSdkVersion