I am running one of my old flutter project in the latest version of android studios and I am facing the issue while running the project please can you help me with this.
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.
Multiple task action failures occurred: 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.window:window-java:1.0.0-beta04. AAR metadata file: C:\Users\disha.gradle\caches\transforms-2\files-2.1\625039eaad011f884ddd84f857a44b7f\jetified-window-java-1.0.0-beta04\META- INF\com\android\build\gradle\aar-metadata.properties. 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.window:window:1.0.0-beta04. AAR metadata file: C:\Users\User_Name.gradle\caches\transforms-2\files-2.1\a78fdf90e4c1f8464b19895cfb365f3f\jetified-window-1.0.0-beta04\META-INF\c om\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 8s Running Gradle task 'assembleDebug'... 9.5s Exception: Gradle task assembleDebug failed with exit code 1
Solution of the error
CodePudding user response:
the error is kind of obvious , As the log says
"The minCompileSdk (31) is greater than this module's compileSdkVersion (android-30)"
which means you are trying to run a project with a minimum android api version of 31 on the emulator or device with the android api version of 30 .
Solution 1 : Reduce the SDK version for the project (Which is not recommended because you have increased it for a reason )
Solution 2 : Change the emulator or the device for debug .
For more guides on android api version : check here
But you might run into more gradle failures , AS ALWAYS , hope not but if you did please make a new issue .
CodePudding user response:
What you need to do is to update your build.gradle
file in android/app folder.
Set the following to this values:
compileSdkVersion 31
minSdkVersion 19 or (Lower if you want to cater older versions)
targetSdkVersion 31