skip to Main Content

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:Usersdisha.gradlecachestransforms-2files-2.1625039eaad011f884ddd84f857a44b7fjetified-window-java-1.0.0-beta04META-
INFcomandroidbuildgradleaar-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:UsersUser_Name.gradlecachestransforms-2files-2.1a78fdf90e4c1f8464b19895cfb365f3fjetified-window-1.0.0-beta04META-INFc
omandroidbuildgradleaar-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

2

Answers


  1. 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 .

    Login or Signup to reply.
  2. 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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search