1
resposta

Erro ao tentar fazer o build

  • Error running Gradle: ProcessException: Process "C:\Users\rnre\Documents\AA\my_project\android\gradlew.bat" exited abnormally: Starting a Gradle Daemon (subsequent builds will be faster)

Configure project :app File C:\Users\rnre.android\repositories.cfg could not be loaded. Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\rnre\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Build-Tools 28.0.3 not accepted. Checking the license for package Android SDK Platform 28 in C:\Users\rnre\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\rnre\Documents\AA\my_project\android\build.gradle' line: 26

  • What went wrong: A problem occurred evaluating root project 'android'.

    A problem occurred configuring project ':app'. Failed to install the following Android SDK packages as some licences have not been accepted.

      build-tools;28.0.3 Android SDK Build-Tools 28.0.3
      platforms;android-28 Android SDK Platform 28

    To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

    Using Android SDK: C:\Users\rnre\AppData\Local\Android\sdk

  • 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 1m 35s Command: C:\Users\rnre\Documents\AA\my_project\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

1 resposta

Na pasta de instalação do Flutter, edite o arquivo flutter.gradle. (c:\flutter\packages\flutter_tools)

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

Em seguida, no seu projeto, altere o arquivo gradle-wrapper.properties (.\android\gradle\wrapper) e atualize a versão do gradle, no meu caso estou usando a 5.6.

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip