Home > Mobile >  Android : How can I know what dependency require a certain mincompileapk?
Android : How can I know what dependency require a certain mincompileapk?

Time:09-22

So I had this issue 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).

which is answered here : The minCompileSdk (31) specified

My question is : how could I have known which dependency brought this issue ? How did the user laalto knew it was android core ?

I tried looking at https://mvnrepository.com/ but it does not talk about any mincompile version : https://mvnrepository.com/artifact/androidx.core/core-ktx/1.7.0-beta01

Thank you in advance for your answer.

CodePudding user response:

The compile error should tell you the dependency that is causing the issue. In Android Studio, check right hand side of the build tab. In my case I found it was androidx.core:core-ktx because the compiler gave this error:

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-beta01.
AAR metadata file: /Users/XX/.gradle/caches/transforms-2/files-2.1/XX/jetified-core-ktx-1.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.

The BETA jumped out at me straight away. Double check your gradle.build files. The error is likely caused by an ambiguous version specification of a library that your project implements. A new version is probably being used that requires a higher minimum compile version. After checking build.gradle files for all my modules, I found that I had included the following in one of my modules:

implementation "androidx.core:core-ktx: "

I checked the Android Developer website and found that the latest stable release was actually 1.6.0. After changing the line above to specify the stable release, it solved my problem, ie:

implementation "androidx.core:core-ktx:1.6.0"

Keeping all of your dependencies up to date is important, but I would rather manually manage these to prevent issues like this rather than letting the compiler use unstable versions or versions that require a higher minimum compile target, for example.

  • Related