close

[Solved] The minCompileSdk (31) specified in a dependency’s AAR metadata is greater than this module’s compileSdkVersion

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error while building my app The minCompileSdk (31) specified in a dependency’s AAR metadata is greater than this module’s compileSdkVersion Error in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How The minCompileSdk (31) specified in a dependency’s AAR metadata is greater than this module’s compileSdkVersion Error Occurs?

I am facing the following error while building my app.

The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.core:core-ktx:1.7.0-alpha02. AAR metadata file: C:\Users\ssc.gradle\caches\transforms-2\files-2.1\a20beb0771f59a8ddbbb8d416ea06a9d\jetified-core-ktx-1.7.0-alpha02\META-INF\com\android\build\gradle\aar-metadata.properties.

How To Solve The minCompileSdk (31) specified in a dependency’s AAR metadata is greater than this module’s compileSdkVersion Error?

  1. How To Solve The minCompileSdk (31) specified in a dependency's AAR metadata is greater than this module's compileSdkVersion Error?

    To Solve The minCompileSdk (31) specified in a dependency's AAR metadata is greater than this module's compileSdkVersion Error Just add this line of code above on the package in-app Gradle file Or You should Set both compileSdkVersion and targetSdkVersion to 31 in your build.gradle(app) file.

  2. The minCompileSdk (31) specified in a dependency's AAR metadata is greater than this module's compileSdkVersion

    To Solve The minCompileSdk (31) specified in a dependency's AAR metadata is greater than this module's compileSdkVersion Error Just add this line of code above on the package in-app Gradle file Or You should Set both compileSdkVersion and targetSdkVersion to 31 in your build.gradle(app) file.

Solution 1: Just add this line of code in app Gradle file.

Just add this line of code above on the package in-app Gradle file.

configurations.all {
       resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}

Just Like Below.

Solution 2: Set compileSdkVersion and targetSdkVersion to 31 in build.gradle

You should Set both compileSdkVersion and targetSdkVersion to 31 in your build.gradle(app) file.

android {
    compileSdkVersion 31 // <-- This
    defaultConfig {
        applicationId "com.example.app"
        targetSdkVersion 31 // <-- and this too
        // ...
    }
}

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment