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?
- How To Solve The minCompileSdk (31) specified in a dependency’s AAR metadata is greater than this module’s compileSdkVersion Error?
- Solution 1: Just add this line of code in app Gradle file.
- Solution 2: Set
compileSdkVersion
andtargetSdkVersion
to31
inbuild.gradle
- Summary
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?
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
andtargetSdkVersion
to31
in yourbuild.gradle(app)
file.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
andtargetSdkVersion
to31
in yourbuild.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
I reinstalled android studio but the problem return. It was easy to change the gradle scripts compileSdk and targetSdk to 31.
Thank you!
Brilliant…! Just edit:
* in Gradle Scripts (build.gradle – .app) compileSdk to 31 and targetSdk to 31
** Then, in the Build menu, clean (Clean Project) and rebuild (Rebuild Project)
*** It worked…!
Thank you.
it works for me too
It’s my Pleasure to Help You Loyola. Thank You For Your Valuable words.
Thank you so much. This worked great for me. Much appreciated.
-jc
thankyou so much… It will work..
Thank you soooo much!!!!! It woks!!!!
My pleasure to help You. Thank You For your valuable comment Manny.
Thanks bro