close

[Solved] The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01

Hello Guys, How are you all? Hope You all Are Fine. Today I am making build of my react-native android project but I am facing following error The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01 in react-native. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01 Error Occurs ?

I am making build of my react-native android project but I am facing following 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.work:work-runtime:2.7.0-beta01.

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 minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01 Error ?

  1. How To Solve The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01 Error ?

    To Solve The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01 Error Here this error occurs because of dependencies are using work-runtime:2.7.0-beta01 and that is updated and work-runtime:2.7.0-beta01 is now updated compileSdkVersion to 31 Here We have to scenario. update your compileSdkVersion to 31 use an older version of work-runtime.

  2. The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01

    To Solve The minCompileSdk (31) specified in a dependency’s is greater than this module’s compileSdkVersion androidx.work:work-runtime:2.7.0-beta01 Error Here this error occurs because of dependencies are using work-runtime:2.7.0-beta01 and that is updated and work-runtime:2.7.0-beta01 is now updated compileSdkVersion to 31 Here We have to scenario. update your compileSdkVersion to 31 use an older version of work-runtime.

Solution 1: update your compileSdkVersion to 31

Here this error occurs because of dependencies are using work-runtime:2.7.0-beta01 and that is updated and work-runtime:2.7.0-beta01 is now updated compileSdkVersion to 31

Here We have to scenario.

  1. update your compileSdkVersion to 31
  2. use an older version of work-runtime

adding this to your build.gradle should fix it

api(group: "androidx.work", name: "work-runtime") {
    version {
        strictly "2.7.0-alpha04"
    }
}

Solution 2: use an older version of work-runtime

Here by using an older version of work-runtime 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
    }
}

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment