0

I am confused about the requirement/behavior of targetSdkVersion. 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 lollipop.

Can any one explain how this works.

Pravin Divraniya
  • 4,223
  • 2
  • 32
  • 49
Mohamed Samsudeen
  • 1,046
  • 1
  • 8
  • 20
  • `targetSdkVersion` has nothing to do with your UI .It just specifies the API Level on which the application is designed to run. – Sunil Sunny Nov 30 '16 at 09:45
  • still i am unclear. Can you provide me an example on how it will affect the behavior of my application in different devices. – Mohamed Samsudeen Nov 30 '16 at 09:50
  • You said ripple effects worked even when targetSdkVersion was set to 1 which is a good eg right? setting targetSDKVersion to any value will not affect your application expect if it is greater than 23 in this case you have to add runtime permissions.You are confused with compileSdkVersion. – Sunil Sunny Nov 30 '16 at 10:15
  • 1
    If you set your targetVersion as 22 and minSdkVersion as 15 it just says your app was tested between this versions of devices but will work on 23 and higher but was not tested . – Sunil Sunny Nov 30 '16 at 10:21

2 Answers2

3

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.

siliconeagle
  • 7,379
  • 3
  • 29
  • 41
-1

The targetSDK in my opinion will not matter the behavior of your app.It is just the API level and does not deal with the user Interface part.

An integer designating the API Level that the application is targetting.

With this attribute set, the application says that it is able to run on older versions (down to minSdkVersion), but was explicitly tested to work with the version specified here. Specifying this target version allows the platform to disable compatibility settings that are not required for the target version (which may otherwise be turned on in order to maintain forward-compatibility) or enable newer features that are not available to older applications. This does not mean that you can program different features for different versions of the platform—it simply informs the platform that you have tested against the target version and the platform should not perform any extra work to maintain forward-compatibility with the target version.

Hope this helps mate!!Cheers Happy Coding

Akshay
  • 1,161
  • 1
  • 12
  • 33