skip to Main Content

A week ago the app was running perfectly but all of a sudden (without updating anything) the app is not running.

I am getting this error when I try to run the app

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: /home/kishan/.gradle/caches/transforms-2/files-2.1/af85edd7f0482dfc2b2e0c9a0519784e/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.

Here is the screenshot for the same:

enter image description here

From my app level gradle file, I can see that I am having

compileSdkVersion 30 and targetSdkVersion 30

Not sure what is causing this issue.

Any help would be appreciated.
Thank You!

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. Leave targetSdkVersion 30, but change compileSdkVersion to be 31.

    The work manager beta probably also uses Android SDK 31.

    When you compile Android SDK 30, work manager cannot compile since it uses Android SDK 31, and therefore uses new APIs which does not exist in Android SDK 30.

    Edit

    Work Manager release notes of 2.7.0 explicitly warns that this version and above only compatible with API 31.

    So your options are:

    • Use 2.6.0, which compiles API 30.
    • Compile API 31 and try to handle the other broken dependencies – maybe Stack Overflow can help you out?
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search