Update library module's targetSdkVersion when updating app's targetSdkVersion - android

I have an app which uses a library module, both having targetSdkVersion 21.
Now I want to make my app marshmallow compatible. So while updating my app's targetSdkVersion to 23, do I need to update library module also ?

It is good practice to always target the latest SDK available. If you upgrade your app's targetSdkVersion to 23, but leave your library's targetSdkVersion in 21, resources coming from the library will be styled targeting 21 even though you might be running on 23.

Related

Issues executing code on higher API levels Android

My minSDK version is 16 and my targetSDK version is 27. The compileSDK version is 28.
Since the targetSDK version is 27 it should run on Oreo(8.0.0) without issues but some of the features don't work as intended. However they do work fine on Nougat.
Why is this so?
The targetSDK is stating what you built in the app to be able to handle. So, there might be a new feature in API 28 and you're saying your code was build against API 27 so if you're running on API 28 and there is support on 28 for how you used the api before, then it will try to maintain your API 27 coded behavior. There still exists the possibility your API 27 code will result in different or wrong behavior if run on API 28 though.
Please review the documentation as well:
https://developer.android.com/guide/topics/manifest/uses-sdk-element
"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."

Instant app targetSdk Version

I am trying to upload my instant app with targetSdkVersion 25 and my installed app is also with targetSdkVersion 25.
When I try to upload my instant app on play console, I am getting the following error,
I do not see in documentation that it is mandatory to support targetSdkVersion 26. What am I missing here ?
I cannot update my targetSdkVersion to 26 since targetting for my installable and instant app should be same.
My installable app must have targetSdkVersion of 25 for now due to a dependency. Can I upload my instant app with targetSdkVersion of 25 ?
Read Prepare your development environment.
Android SDK Build-Tools 26.x or higher
Android SDK Platform Tools 25.x or higher
Android SDK Tools (latest)
You should set
compileSdkVersion 27
buildToolsVersion '27.0.3'
And
defaultConfig {
targetSdkVersion 26
}
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.
For those who are still wondering about this issue. Google imposed a restriction that both Instant app and install-able app should target at least 26.

minSdkVersion is different than the minimum api level

I'm a little confused! I made an Android app which has these lines of code in the Gradle file:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.ayech0x2.navigationbarforallactivitites"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
So as you see the minimum version of Android is Lolipop after that I used an app called Install APKs to see my apk pieces of information I found that the minimum API level is 3 (Cupcake)! what did this mean? What's the difference between minSdkVersion and minimum API level?
Thank you very much for your time and assistance in this matter.
The minSdkVerison and minimum API level is same. You cannot install the apk on an Android OS of api level below minimum api level. the apk checking tool may have some problem in checking the details.
minSdkVersion and Minimum API Level refers the same thing. If you are specifying the minSdkVersion as 21, the app will not get installed on the device with API level below 21.
Something might be wrong with the app checking the minimum API level of your app.
You can verify it yourself by trying to install the app in the devices below the specified API level.
minSdkVersion: is the minimum version of the Android OS required to run your application.
Minimum API Level: is also the same as minSdkVersion
I think which app you used Install APKs isn't working properly.

Which Android SDK select for compile

I'm beginner in Android coding and i don't know if i need to create my first application by coding on Android SDK 2.2 or 7.1 (the latest version right now).
To make it clear, I will create an application to run on any type of android smartphone.
Thank you.
Per the Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion blog post:
Therefore it is strongly recommended that you always compile with the latest SDK
Therefore you should compile with Android 7.1
minSdkVersion is the lower bound for your app
Generally, libraries you use will have a minSdkVersion - your app won't be able to support anything lower than that. Google Play services, for example, currently has a minSdkVersion of 9 (although it is increasing to 14 soon)
targetSdkVersion is the main way Android provides forward compatibility by not applying behavior changes unless the targetSdkVersion is updated
And your targetSdkVersion is best set to the highest level of Android you've tested your app on.
You'll note the conclusion of the article:
Ideally, the relationship would look more like this in the steady state:
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)

How to set the right android:minSdkVersion and android:targetSdkVersion for Android 5.0.2?

I'm getting a Parsing error from my React Native generated .apk file. So I'm trying changing the android:minSdkVersion and android:targetSdkVersion in my manifest file.
My device is running Android 5.0.2. To what should I set those two options?
The minSdkVersion is minimum version of Android that you are going to support. If you don't need to support for pre-4.0 Android devices then recommended minSdkVersion is 16.
The compileSdkVersion is the version of the API the app is compiled against. It's recommended to use the latest one, which 23 for now.
The targetSdkVersion is supposed to indicate that you have tested your app on (presumably up to and including) the version you specify. So it's also should be the latest one.
Android 5.0.2 is API level 21.
android:minSdkVersion and android:targetSdkVersion should be around them.
But include 21.
for example:
minSdkVersion = 15
targetSdkVersion = 22
Keep in mind, that some functions are not included in low API levels. if you set the Version in build.gradle, Android Studio will warn you if you want to use a function that's not supported in minSDKVersion.

Categories

Resources