Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between "min sdk , target sdk and compile with " ? in android

What is the difference between "min SDK, target SDK and compile with" in android?

What is the difference between "minimum SDK, target SDK and compile with", that appears when I try to make a new Android application project !! like this...

Minimun SDK : API 14 Target SDK : API 17 Compile With : API 14

And are my choices good ?? or Which ones should I choose? Sorry, I tried to put a photo, but I can't...

like image 616
without name Avatar asked Sep 02 '14 14:09

without name


3 Answers

android:minSdkVersion

An integer designating the minimum API Level required for the application to run. The Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute. You should always declare this attribute.

android:targetSdkVersion

An integer designating the API Level that the application targets. If not set, the default value equals that given to minSdkVersion. This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion).

As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform 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. You can disable such compatibility behaviors by specifying targetSdkVersion to match the API level of the platform on which it's running. For example, setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher and also disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens).

There are many compatibility behaviors that the system may enable based on the value you set for this attribute. Several of these behaviors are described by the corresponding platform versions in the Build.VERSION_CODES reference.

To maintain your application along with each Android release, you should increase the value of this attribute to match the latest API level, then thoroughly test your application on the corresponding platform version. Introduced in: API Level 4

android:maxSdkVersion

An integer designating the maximum API Level on which the application is designed to run. In Android 1.5, 1.6, 2.0, and 2.0.1, the system checks the value of this attribute when installing an application and when re-validating the application after a system update. In either case, if the application's maxSdkVersion attribute is lower than the API Level used by the system itself, then the system will not allow the application to be installed. In the case of re-validation after system update, this effectively removes your application from the device.

please go through this link for more details

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

like image 125
Anil kumar Avatar answered Oct 16 '22 20:10

Anil kumar


Simply,

Minimun SDK : API 14

refers that that your application will only run on mobile phone with api level 14 ie.(ICS 4.0) or higher. Your app will fail to run on previous versions of android like gingerbread & froyo.

Target SDK : API 17

refers to the version of android you want to build for, which is Jellybean on your case. It is recommended to keep latest as far as possible which is (api 20 Kitkat at present context).

Compile With : API 14

refers to version of andriod you are testing on. Complile with api 14 means you are going to test your app on ICS.

you could also watch this video:

https://www.youtube.com/watch?v=Sxo5zMcOCXM>

like image 34
incr3dible noob Avatar answered Oct 16 '22 20:10

incr3dible noob


Trying to keep it simple as possible I can explain the three terms in the following way:

Min Required SDK: shows the device with the minimum android version you want your app to support. So for instance, if you select API 11: Honey Comb in the drop down list. This will show that your app won't support/won't run on any android device having android version lower than Honey Comb.

Target SDK: This should always be kept as higher as possible as it tells the maximum android version you have been targetting or testing your app with. So, if you keep your minReqSDK>> 11 (honey comb) and targetSDK>> 21 (Lollipop), this shows that your app will run on all android versions from honeycomb to Lollipop with no compatibility issues as you have set your target SDK>> 21 Lollipop version.

Compile With: This has nothing to do with android supporting whatever devices. You can chose any android version which you have installed using your SDK manager to compile and run your app for development purpose.

In your case: min sdk version: 14 target sdk :17 compile with: 14

Your device will support all android version having api level 14 (Ice Cream Sandwich) to api level 17 (Jelly Bean 4.2). And you have been using api level 14 (ICS) to compile and run your app for development.

Hope this helps.

like image 41
Amir Aslam Avatar answered Oct 16 '22 21:10

Amir Aslam