I'm developing an app which uses targetSdkVersion 27. We would like to integrate the Samsung Health Android SDK which has a targetSdkVersion support of 25.
Can this be done without problems?
Also the Play Store has a limit of min targetSDkVersion of 26 since this month. What does this mean regarding this? Will we able to upload the app into the Play Store?
Thanks
When building your project, Android Studio would merge the manifests of your libraries and your app. In the case of your libraries having a lower targetSDKVersion than your app, the app's version has higher priority and will override the library's.
https://developer.android.com/studio/build/manifest-merge
I have looked at the documentation for building with Gradle, but I'm still not sure what the difference between compileSdkVersion and targetSdkVersion is.
All it says is:
The `compileSdkVersion` property specifies the compilation target.
Well, what is the "compilation target"?
I see two possible ways to interpret this:
compileSdkVersion is the version of the compiler used in building the app, while targetSdkVersion is the "API level that the application targets". (If this were the case, I'd assume compileSdkVersion must be greater than or equal to the targetSdkVersion?
They mean the same thing. "compilation target" == "the API level that the application targets"
Something else?
I see that this question has been asked before, but the one answer just quotes the doc, which is what is unclear to me.
compileSdkVersion
The compileSdkVersion is the version of the API the app is compiled against. This means you can use Android API features included in that version of the API (as well as all previous versions, obviously). If you try and use API 16 features but set compileSdkVersion to 15, you will get a compilation error. If you set compileSdkVersion to 16 you can still run the app on a API 15 device as long as your app's execution paths do not attempt to invoke any APIs specific to API 16.
targetSdkVersion
The targetSdkVersion has nothing to do with how your app is compiled or what APIs you can utilize. The targetSdkVersion is supposed to indicate that you have tested your app on (presumably up to and including) the version you specify. This is more like a certification or sign off you are giving the Android OS as a hint to how it should handle your app in terms of OS features.
For example, as the documentation states:
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...
The Android OS, at runtime, may change how your app is stylized or otherwise executed in the context of the OS based on this value. There are a few other known examples that are influenced by this value and that list is likely to only increase over time.
For all practical purposes, most apps are going to want to set targetSdkVersion to the latest released version of the API. This will ensure your app looks as good as possible on the most recent Android devices. If you do not specify the targetSdkVersion, it defaults to the minSdkVersion.
As a oneliner guide:
minSdkVersion <= targetSdkVersion <= compileSdkVersion
Ideally:
minSdkVersion (lowest possible) <= targetSdkVersion == compileSdkVersion (latest SDK)
Read more from this great post by Ian Lake
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:
That targetSdkVersion impacts the way in which permissions are requested:
If the device is running Android 6.0 (API level 23) or higher, and the app's targetSdkVersion is 23 or higher, the app requests permissions from the user at run-time.
If the device is running Android 5.1 (API level 22) or lower, or the app's 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 version
compileSdkVersion, on the other hand, does not need to be changed unless you're adding features exclusive to the new platform version
As a result, while targetSdkVersion is often (initially) less than than the compileSdkVersion, it's not uncommon to see a well-maintained/established app with targetSdkVersion > compileSdkVersion
The compileSdkVersion should be newest stable version.
The targetSdkVersion should be fully tested and less or equal to compileSdkVersion.
The CompileSdkVersion is the version of the SDK platform your app works with for compilation, etc DURING the development process (you should always use the latest) This is shipped with the API version you are using
You will see this in your build.gradle file:
targetSdkVersion: contains the info your app ships with AFTER the development process to the app store that allows it to TARGET the SPECIFIED version of the Android platform. Depending on the functionality of your app, it can target API versions lower than the current.For instance, you can target API 18 even if the current version is 23.
Take a good look at this official Google page.
I see a lot of differences about compiledSdkVersion in previous answers, so I'll try to clarify a bit here, following android's web page.
A - What Android says
According https://developer.android.com/guide/topics/manifest/uses-sdk-element.html:
Selecting a platform version and API Level When you are developing
your application, you will need to choose the platform version against
which you will compile the application. In general, you should compile
your application against the lowest possible version of the platform
that your application can support.
So, this would be the right order according to Android:
compiledSdkVersion = minSdkVersion <= targetSdkVersion
B - What others also say
Some people prefer to always use the highest compiledSkdVersion available. It is because they will rely on code hints to check if they are using newer API features than minSdkVersion, thus either changing the code to not use them or checking the user API version at runtime to conditionally use them with fallbacks for older API versions.
Hints about deprecated uses would also appear in code, letting you know that something is deprecated in newer API levels, so you can react accordingly if you wish.
So, this would be the right order according to others:
minSdkVersion <= targetSdkVersion <= compiledSdkVersion (highest possible)
What to do?
It depends on you and your app.
If you plan to offer different API features according to the API level of the user at runtime, use option B. You'll get hints about the features you use while coding. Just make sure you never use newer API features than minSdkVersion without checking user API level at runtime, otherwise your app will crash. This approach also has the benefit of learning what's new and what's old while coding.
If you already know what's new or old and you are developing a one time app that for sure will never be updated, or you are sure you are not going to offer new API features conditionally, then use option A. You won't get bothered with deprecated hints and you will never be able to use newer API features even if you're tempted to do it.
My 2 cents: Compile against any version of the SDK but take care not to call any APIs that your "minimum SDK version" does not support. That means you "could" compile against the latest version of the SDK.
As for "target version" it simply refers to what you planned to target in the first place and have possibly tested against. If you haven't done the due diligence then this is the way to inform Android that it needs to perform some additional checks before it deploys your lets say "Lollipop" targeted app on "Oreo".
So the "target version" is obviously not lower than your "minimum SDK version" but it can't be higher than your "compiled version".
Not answering to your direct questions, since there are already a lot of detailed answers, but it's worth mentioning, that to the contrary of Android documentation, Android Studio is suggesting to use the same version for compileSDKVersion and targetSDKVersion.
compiledSdkVersion==> which version of SDK should compile your code to bytecode(it uses in development environment) point: it's better use last version of SDK.
minSdkVersion==> these item uses for installation of APK(it uses in production environment). For example:
if(client-sdk-version < min-sdk-versoin )
client-can-not-install-apk;
else
client-can-install-apk;
Quick summary:
For minSDKversion, see latest entry in twitter handle: https://twitter.com/minSdkVersion
TargetSDKversion: see latest entry in twitter handle: https://twitter.com/targtSdkVersion
or use the latest API level as indicated at devel https://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Compiled version:
make it same as TargetSDKversion
maxSdkVersion:
advice from Android is to not set this as you do not want to limit your app to not perform on future android releases
The Application settings of an Android project's properties in Visual Studio 2017 (15.8.5) has them combined:
I'm very new to Android programming, please allow me ask a very basic question. My question: what is Android SDK version and how it's different from API level?
If uses-sdk in AndroidManifest.xml says "android:minSdkVersion="19" ", does it mean minimum required sdk would be Kitkat 4.4, API level 19?
Thanks
-S
what is Android SDK version and how it's different from API level?
SDK Versions and API levels as concepts are the same thing.
However the Android SDK version you compile your app with is independent from of what API level your app is running on.
If uses-sdk in AndroidManifest.xml says "android:minSdkVersion="19" ", does it mean minimum required sdk would be Kitkat 4.4 , API level 19? Thanks -S
That means that the earliest version of Android your app will be installed on via the Google Play Store will be Android 4.4 (API 19) devices.
I'd strongly suggest reading the Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion blog post, which goes into detail on each of these, how they relate, and what you should use.
The basic requirement is
minSdkVersion <= targetSdkVersion <= compileSdkVersion
But the ideal situation for apps, particularly new apps, it should be
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)
API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.
The Android platform provides a framework API that applications can use to interact with the underlying Android system. The framework API consists of:
A core set of packages and classes
A set of XML elements and attributes for declaring a manifest file
A set of XML elements and attributes for declaring and accessing resources
A set of Intents
A set of permissions that applications can request, as well as permission
enforcements included in the system
Each Android version have its own API.
Answering your question, yes with "android:minSdkVersion="19" the minimum android version for app would be KitKat 4.4
I have been working on an Android project from past one year in Eclipse with API level set to 4.2 (target SDK 17).
Now I want to publish it in the Play Store. Should I change the target SDK (manifest file) to the latest (i.e. 4.4) since my app works perfectly on KitKat?
The purpose of targetSdkVersion is explained in the developer documentation for <uses-sdk>:
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.
TL;DR: You should set targetSdkVersion to the API level that you've primarily been developing and testing on. Google recommends that you see to it that this is the latest Android version, but that may not always be feasible (for financial and other reasons).
See your app will work fine with kitkat because the newer versions are always made to be compatible with the older android versions,but vice versa is not true....if you develop something in higher API level and then try to run it in older versions of android, than it may happen that your app may not work or some features may not work as expected.So,you too can add KITKAT compatibility in your android manifest file ...cheers
As per this announcement you have to make sure to use a recent target SDK (at most one or two versions older than the most recent), otherwise you cannot publish your app in the Play Store. This is enforced for new apps as of August 2018 and November 2018 for updating existing apps, requiring you to target API level 26 or newer.
Some Amazon docs hint that it is 10, but examples run with 8. So what is the correct/safe/practical answer?
It is the minimum SDK requirement for application, App Developers put this variable to not install this app earlier version of device than min SDK version, it is just a safe check, to not install the app on incompatible devices
According to wikipedia http://en.wikipedia.org/wiki/Kindle_Fire the first Kindle Fire was based on Android 2.3.4 which is based on Android SDK version 10. Therefore there is no benefit to use minSdkVersion lower than 10.
If you use minSdkVersion lower than 10 your app will run on all Kindle Fires because new Android versions can run apps written for older Android versions.
However if you specify min SDK version 10 you can use all APIs that is available in the SDK version 10 but is not available in the Android SDK version 8.