. Advertisement .
..3..
. Advertisement .
..4..
There are a lot of variables to take into consideration when building Android applications and it can be a daunting task for those who are not familiar with the environment. This can lead to a lot of errors occurring that may seem trivial to some developers, but they can be very problematic.
One such error is the Error “The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01”. Read on to fix it.
Why dose this problem occur?
Your react-native android project is being built, this problem occurred since work-runtime dependencies are used: work-runtime:2.7.0-beta01, which has been upgraded, as well as CompileSdkVersion, has been upgraded to 31. We must create a scenario in this case. Utilize an older version of work-runtime and upgrade your compileSdkVersion to 31. To explore the detail of solution, click the below message to get it in.
Before to see the solution, you just check the wanring message that you can get as follow.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> 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.work:work-runtime:2.7.0-beta01.
AAR metadata file: /Users/ssc/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
How To Solve The Error “The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01”?
Option 1: Upgrade The compileSdkVersion to 31
This problem occurred since work-runtime dependencies are used: work-runtime:2.7.0-beta01, which has been upgraded, as well as CompileSdkVersion, has been upgraded to 31.
We must create a scenario in this case.
- Upgrade the compileSdkVersion to 31
- Utilize an older version of work-runtime
Including this to the build.gradle will solve it:
api(group: "androidx.work", name: "work-runtime") {
version {
strictly "2.7.0-alpha04"
}
}
Option 2: Utilize the older version of work-runtime
You can solve it by pushing Gradle to utilize an older version of Work Manager for the transitive dependency, which functions with API 30, by utilizing an older version of work-runtime. Add the gradle file to your build.
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
}
}
Option 3: Downgrade its version
Downgraded its version by adding this
configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
}
inside
android {
defaultConfig {
//here
}
}
Conclusion
We hope our blog post on “Solving the error “The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01” was useful. With this information, you should be able to handle this issue and a slew of other concerns when you design your application.
Please leave a comment if you want to learn more about the topic or if you have any questions or ideas to share. Thank you for taking the time to read this!
Leave a comment