androidx.core:core-ktx:1.7.0 Depenceny Error Appeared Without Any Modification?

Viewed 3771

While runs/builds working properly, Android studio started giving this error since a few hours. Btw I'm sure that i never add/modify any dependency on project.

Execution failed for task ':app:checkPrepReleaseAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > 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: /Users/userxyz/.gradle/caches/transforms-2/files-2.1/cefbfad6ef180119f5f4851a3efddbb7/jetified-core-ktx-1.7.0-alpha02/META-INF/com/android/build/gradle/aar-metadata.properties.

What i’ve tried:

  1. Invalidate caches and restart
  2. Re-download project and add to studio again

Android studio version, Arctic fox 2020.3.1

2 Answers

I have also face this issue with androidx.core:core-ktx:1.7.0 than downgrade to androidx.core:core-ktx:1.6.0 and its working fine and there is same problem with

'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'

It seems your project's minCompileSdk is 31 but core-ktx uses 30. Try to downgrade your project's minCompileSdk to 30 and see if it solves your problem or not.

Related