How Do I Change My minCompileSDK Version In Android Studio?

Viewed 829

I just pulled up the android studio again and the current SDK version appears to have major bugs. While on SDK version 31 I get an error message saying SDK tools are corrupted and to uninstall then reinstall version 31.

When I switch to version 30 I get another error message stating that "the minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/Gradle/aarmetadata.properties) is greater than this module's compileSdkVersion", and I can't find any sources on google for altering minCompileSdk.

I just need to fix one of these problems, not both.

p.s. - I have already uninstalled and reinstalled APK 31 several times.

3 Answers

in your project, app -> build.gradle:

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "...."
        minSdkVersion 16
        targetSdkVersion 30
    }
}

here the minSdkVersion is minCompileSdk.

You can change minSdk and targetSdk. And ensure minSdk and target < compileSDK

  compileSdk 31

defaultConfig {
    ...
    minSdk 25
    targetSdk 31
    ...

    
}

"the minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/Gradle/aarmetadata.properties) Im set compileSdk 31 to fixed that error. Show me your build.gradle

Thanks for the feedback! It looks like the solution was to change targetSDKversion and compileSDKVersion to 31 but keep buildToolsVersion at 30.0.3. I'm guessing any version between target and min will work.

Related