Reputation: 7105
while running Flutter debug following error has arisen,
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: /home/javeed/.gradle/caches/transforms-2/files-2.1/9d7505e2cdbb28aad564446b7c211aea/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 19s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin device_info...
Exception: The plugin device_info could not be built due to the issue above.
Exited (sigterm)
Upvotes: 0
Views: 1465
Reputation: 2257
Change compileSdkVersion
to 31
in your android/app/build.gradle
. You are trying to use a library that requires the compile SDK version to be at least 31. The library seems to be work-runtime-2.7.0-beta01
so using a lower version, which does not have this requirement, can also be a solution.
Upvotes: 0
Reputation: 1046
Try adding this snippet in the app/build.gradle file above the android {...}
configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }}
Upvotes: 1
Reputation: 1880
Search for compileSdkVersion 31
globally and replace it with compileSdkVersion 30
Upvotes: 0