How can I resolve the error “The minCompileSdk (31) specified in a dependency’s AAR metadata” in native Java or Kotlin?

We Are Going To Discuss About How can I resolve the error “The minCompileSdk (31) specified in a dependency’s AAR metadata” in native Java or Kotlin? . So lets Start this Java Article.

How can I resolve the error “The minCompileSdk (31) specified in a dependency’s AAR metadata” in native Java or Kotlin?

  1. How can I resolve the error “The minCompileSdk (31) specified in a dependency's AAR metadata” in native Java or Kotlin?

    The minCompileSdk is 31, but the minSdkVersion is significantly lower.
    Increasing the compileSdk of your project is enough to fix the issue. There is no need for overrides or even changing the targetSdk.

  2. The minCompileSdk (31) specified in a dependency's AAR metadata

    The minCompileSdk is 31, but the minSdkVersion is significantly lower.
    Increasing the compileSdk of your project is enough to fix the issue. There is no need for overrides or even changing the targetSdk.

Solution 1

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
        // ...
    }
}

Original Author CopsOnRoad Of This Content

Solution 2

I have found the solution. Enter this line of code above package in the app Gradle file.

For Kotlin developers:

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

Screenshot of code with a red freehand circle

For Java developers

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

Original Author Peter Mortensen Of This Content

Solution 3

This issue is most often seen with libraries that declare

implementation androidx.core:core-ktx:1.7.0-beta01

The minCompileSdk is 31, but the minSdkVersion is significantly lower.
Increasing the compileSdk of your project is enough to fix the issue. There is no need for overrides or even changing the targetSdk.

android {
    compileSdk 31

...
}

Original Author Abandoned Cart Of This Content

Solution 4

Finally, I can solve my issue.

What was the problem?

I had the following dependency in one module –

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

but other modules, including the app module, had the following dependency

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

Converting

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

to

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

solved my problem.

Original Author Saiful Islam Sajib Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment