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:
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
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
inside
and it resolved my issue.
Leave
targetSdkVersion 30
, but changecompileSdkVersion
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: