Android App Won't Build -- the Mincompilesdk (31) Specified in a Dependency's Androidx.Work:Work-Runtime:2.7.0-Beta01

Android app won't build -- The minCompileSdk (31) specified in a dependency's androidx.work:work-runtime:2.7.0-beta01

The error is being caused because one of your dependencies is internally using WorkManager 2.7.0-beta01 that was released today (which needs API 31). In my case it was CheckAarMetadata.kt.

You can fix it by forcing Gradle to use an older version of Work Manager for the transitive dependency that works with API 30. In your build.gradle file add:

dependencies {
def work_version = "2.6.0"
// Force WorkManager 2.6.0 for transitive dependency
implementation("androidx.work:work-runtime-ktx:$work_version") {
force = true
}
}

This should fix it.

Android - App not running. Error : The minCompileSdk specified in a dependency's AAR metadata is greater than this module's compileSdkVersion

Ok So finally I resolve this issue.

The issue was because of the dependency androidx.work:work-runtime
But I would like to first mention that I was not using that dependency in my project directly (not added in my app level gradle), probably some other dependency was using that internally.

So what I did is forcefully downgraded its version by adding this

configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
}

inside

android {
defaultConfig {
//here
}
}

and it resolved my issue.

How to solve minCompileSdk (31) specified in a dependency's AAR metadata in android studio

All folks who are getting these errors. I solved this error by adding following line of code in app-level build.gradle file under defaultconfig.

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

I have already pasted the work-runtine line of code but @soujanya gave me one more line of code which is core-ktx:1.6.0. I pasted same under work-runtime and BOOOOM!!! it suddenly compiled my code.

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

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' }
}

How can I resolve the error The minCompileSdk (31) specified in a dependency's AAR metadata in native Java?

The error message hints at how to resolve the issue. The minCompileSdk can never be higher than your compileSdkVersion which is also hinted in the name of the parameters, as the minCompileSdk is the minimum SDK you want to support, so setting it to a higher value than the compileSdkVersion should intuitively mean that it won't be the minimum sdk version needed.

Either downgrade your minCompileSdk to 30 og upgrade your compileSdkVersion to 31, to fix this issue. You can read more about these parameters in this thread: What is the difference between compileSdkVersion and targetSdkVersion?

The minCompileSdk (31) specified in a dependency's AAR metadata is greater than this module's compileSdkVersion (android-30)

The problem was facebook flipper.

I have upgraded flipper from version 0.54.0 to 0.129.0 in android/gradle.properties.

Looks like this problem was introduced in version 0.128.0.

Setting the version to 0.127.0 solved this issue.

However it introduced another issue. On Macbook pro with M1, emulator was crashing with null pointer dereference error.

So I had to downgrade flipper to 0.125.0.



Related Topics



Leave a reply



Submit