I’m trying to create an Android app, but when I create an app, just the default "hello world" app that comes when you create a new project.
But when I try to build the default app it gives me this error…Why?
One or more issues found when checking AAR metadata values:
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.appcompat:appcompat:1.4.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->346d15f5c58a469270eeba15db4463d05transformedappcompat-1.4.0META->INFcomandroidbuildgradleaar-metadata.properties.
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.appcompat:appcompat-resources:1.4.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->370088de83757cd2e92dadb8b386e6adbtransformedjetified-appcompat-resources-1.4.0META->INFcomandroidbuildgradleaar-metadata.properties.
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.emoji2:emoji2-views-helper:1.0.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->36cbed90352b213553df3539e2e7f22aftransformedjetified-emoji2-views-helper-1.0.0META->INFcomandroidbuildgradleaar-metadata.properties.
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.emoji2:emoji2:1.0.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->39b79be83fba3907471fe1de63f439d3transformedjetified-emoji2-1.0.0META->INFcomandroidbuildgradleaar-metadata.properties.
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:1.7.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->39339927e08badd09bc5459e4ba900d5ftransformedcore-1.7.0META-INFcomandroidbuildgradleaar->metadata.properties.
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.lifecycle:lifecycle-process:2.4.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->3e4a425e61d135d109d64d5f17d999dftransformedjetified-lifecycle-process-2.4.0META->INFcomandroidbuildgradleaar-metadata.properties.
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.lifecycle:lifecycle-runtime:2.4.0.
AAR metadata file: C:UsersAfonso.gradlecachestransforms->3bca1bb61c15ab5807e64593ca04debeftransformedlifecycle-runtime-2.4.0META->INFcomandroidbuildgradleaar-metadata.properties.
3
Answers
Try to change your build.gradle(app) file.
Set
compileSdkVersion
andtargetSdk
to 30, and Sync your gradle fileIf you read the error messages carefully you can understand:
One simple solution would be to go to gradle build(:app) and change the compileSdkVersion to 30:
It would look something like this:
After the change it should be this:
Change the targetSdkVersion under defaultConfig to 30:
Like this:
Save and run
The minimum compile SDK version of some of your dependencies are set to 31, while your app’s compile SDK is set to 30.
You can simply raise your compileSdk version in module-level build.gradle to 31:
Or you can leave that and instead use older versions of the dependencies you have trouble with. E.g. instead of
it would be
and so on…