Mohamed Samsudeen Mohamed Samsudeen - 9 months ago 60
Android Question

Android targetSdkVersion behavior

I am confused about the requirement/behavior of

. As far as I understood, setting the target SDK to a particular version indicates that behavior of the application (UI) is ensured up-to that particular version.

In my application, I had set my targetSdkVersion to 1 (for testing) and I have some buttons in my page. What I expected was, there will not be any ripple effects in button click (which was introduced in later versions of Android). But there was a ripple effect when I clicked the button.

Application was running on

Can any one explain how this works.

Answer Source

There are three SDK levels of note:

  • targetSdkVersion : this is a hint to Android of what version the app is designed to run on. An example of it relevance is that if you set targetSdkVersion to 22 then android will not enforce permissions introduced in version 23 ... and if you up targetSdKVersion to 23, android takes this as an indication that you app knows how to handle system permission requests.

  • minSdkVersion : the minimum version (that you say) you app will run on. play will not show the app to users on a lower version.

  • compileSdkVersion: this is the version your app is compiled against. You need to download the relevant SDK to build against. This is the variable the would have the effect you expect in the example above. As the relevant system apis wont be available to your app.