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

Advertisements

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?

>Solution :

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"
    }
}

Leave a ReplyCancel reply