Home > Blockchain >  My Flutter app cloned from the GitHub doesn't run and show these errors. I'm new to flutte
My Flutter app cloned from the GitHub doesn't run and show these errors. I'm new to flutte

Time:03-05

Launching lib\main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'...

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 One or more issues found when checking AAR metadata values:

 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-29).
 Dependency: androidx.window:window-java:1.0.0-beta04.
 AAR metadata file: C:\Users\Rasula Wathsara\.gradle\caches\transforms-3\41a83d0cf61e3d2ab42ea706b65148ab\transformed\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.

 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-29).
 Dependency: androidx.window:window:1.0.0-beta04.
 AAR metadata file: C:\Users\Rasula Wathsara\.gradle\caches\transforms-3\bb9a53f8c4dc071c681fa071739dc70b\transformed\jetified-window-1.0.0-beta04\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 12s Exception: Gradle task assembleDebug failed with exit code 1

CodePudding user response:

Detailed StackOverflow Answer

This usually happens when you're opening someone else's project after unzipping it and your current Android Studio Version is older to the version the project was compiled in.

The way to solve it is

Go to Help and about to see your android studio version
go to File>Project Structure> and set your Android Gradle Plugin version to your android studio version
Change the Gradle version to the one you usually use.

Build the project and it should run without any errors

CodePudding user response:

app/src/build.gradle

defaultConfig {

        applicationId "com.example"
        minSdkVersion 19
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

android/build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:7.0.1'
}

You can try this.

  • Related