1
  • 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-rc01. AAR metadata file: C:\Users\100812.gradle\caches\transforms-2\files-2.1\8fcba37f766c3622d8dbd30df4e98577\work-runtime-2.7.0-rc01\META-INF\com\android\build\gradle\aar-metadata.properties.

5 Answers5

0

you can find the compileSdkVersion under: android > app > build.gradle

android {

  compileSdkVersion 31

  ...

}
Manishyadav
  • 1,361
  • 1
  • 8
  • 26
0

Check with your configuration in android/app/src/build.gradle file with new version of flutter compileSdk and targetSdkVersion are mention as below

android {
    compileSdkVersion flutter.compileSdkVersion
.....  
defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.app"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
0

I had faced the same issue, In case you cloned a GitHub repository and then when you run that code this is the error that comes up(as it happened with me) then Solution :

Step 1 : Create a new flutter project at your local system

Step 2 : Copy the code given in main.dart file of stub project and paste it into main.dart file of your local project

Step 3 : Make an 'assets' folder in your local project

Step 4 : download asset-files from GitHub and put them into your local 'assets' folder

Step 5 : in your local pubspec.yaml file, add dependency for your 'assets' folder

Step 6 : Rename MyApp() in widget testing file to MaterialApp()

Hit save(in files other than pubspec.yaml), get all dependencies(in pubspec.yaml) and you're good to go

In short : Copy the required code and the dependencies you want Then Save the changes and run

Error was there in my case mainly because the Flutter V2 has many changes and the code was outdated.

user18520267
  • 180
  • 3
  • 13
0

Go to android/app/build.gradle

Change: From: compileSdkVersion 29 To: compileSdkVersion 31

Lance Olana
  • 154
  • 1
  • 4
0

Please run, then press f you will notice the SDK is the wrong version. npx react-native doctor

scott
  • 1,531
  • 2
  • 16
  • 29