Android Studio What is the difference between minSdkVersion, targetSdkVersion and minSdk, targetSdk? - android

I changed Target SDK Version from 30 to 31 and Min SDK Version from 19 to 22. In build.gradle, the minSdkVersion, targetSdkVersion and targetSdk change accordingly except for minSdk. It is still 19.
android {
compileSdk 31
defaultConfig {
applicationId "com.example.studentsacademicmanagementappsama"
minSdk 19
targetSdk 31
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
targetSdkVersion 31
minSdkVersion 22
}
}
What is the difference between minSdkVersion, targetSdkVersion and minSdk, targetSdk?
Should I change minSdk to 22 or ignore it?

As of the Android Gradle Plugin released in July 2021, you can use either minSdk or minSdkVersion, targetSdk or targetSdkVersion, compileSdk or compileSdkVersion. Why they did this, I'm not sure.
More details on this better answer over here: https://stackoverflow.com/a/67251145/467509

There is no such thing named minSdk , targetSdk and compileSdk in build.gradle.
you should config your app compatibility like this :
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.app.test"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0.0"
}
}

Related

where could i find flutter SDK Min and mix in VS Code

where should i find minSdkVersion from 16 to 21
android/app/build.gradle
it will look like this
defaultConfig {*
applicationId "***"
minSdkVersion 22
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName*
}

minSdkVersion is newer than the device API Level error while installing app

I am installing Android app with target sdk version android S in Android phone with Api level 30. My default config settings for app is like
compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 21
targetSdkVersion "S"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
But when I install the apk in Emulator with Api Level 30 I am getting error as
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_OLDER_SDK
The application's minSdkVersion is newer than the device API level.
How to resolve this ? Which things need to be modified to make it working ?
targetSdkVersion "S"
Using a prelimary version the minSdkVersion becomes S too automatically.
Changing to this version worked
compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Gradle related error

I have recently started using the android studio. Just after installing and downloading all the requisite files, I am welcomed by this error,"Failed to find the target with the hash string 'API 27'....", whereas I already have both API 27 and 28 installed (although 28 shows up to be partly installed).
I am completely new to this software.
Tools
SDK
error
you should use like below in gradle
{
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "xxxxxxxxx"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
don't write like compileSdkVersion 'API 27' its compileSdkVersion 27 only

Running different version in Android library versus your app

I have the following in my main app:
...
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 19
versionName "1.0.5"
}
...
In a library I use, this is defined:
...
android {
compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 7
}
...
I have uppgraded my API target etc. in my app. The library I have, use the same API target etc. (haven't changed the code). If I upgrade my app and use libraries, can I leave them as is? Or do I need to sync the two in respect with compileSdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion?

My app's minSdkVersion is 14 and targetSdkVersion is 21 but Google Play judge it just support Android 4.0~4.4

compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "me.drakeet.seashell"
minSdkVersion 14
targetSdkVersion 21
versionCode 80
versionName "2.2"
}
Above code is in my gradle.build, and my app run perfectly in Android Lollipop (5.0), so I am puzzled that why Play judge and limit it just support Android 4.0~4.4, why not 5.0+?
Thanks!
I have fix it.
just add:
maxSdkVersion 21
in the gradle.build nearby minSdkVersion.

Categories

Resources