Search code examples
androidfluttermetadataexecutionbuild-error

Error occur when I am building my app.(Execution failed for task ':app:checkDebugAarMetadata'.)


  • 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.core:core-ktx:1.7.0-beta01. AAR metadata file: C:\Users\Lara!b.gradle\caches\transforms-2\files-2.1\56c0cb97790e9054921ec81d\jetified-core-ktx-1.7.0-beta01\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.core:core:1.7.0-beta01. AAR metadata file: C:\Users\Lara!b.gradle\caches\transforms-2\files-2.1\ad49c3e20e28519b53\core-1.7.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.


Solution

  • Solution in case you are facing this problem after running code from a cloned repository on GitHub:

    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()

    Checkout my full answer here for an almost same question : https://stackoverflow.com/a/71882107/18520267