Flutter运行Gradle时出错:退出代码1(Ubuntu 18.04 LTS)

时间:2018-10-26 12:38:35

标签: android-studio gradle flutter ubuntu-18.04

我在flutter run中的错误 因此:Ubuntu 18.08 LTS

flutter run
Launching lib/main.dart on moto g 6 play in debug mode...
Initializing gradle...                                       0,7s
Resolving dependencies...                                        
* Error running Gradle:
Exit code 1 from: /home/leonardo/Github/apps-with-flutter/contador_de_pessoas/android/gradlew app:properties:
Starting a Gradle Daemon (subsequent builds will be faster)

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file '/home/leonardo/Github/apps-with-flutter/contador_de_pessoas/android/app/build.gradle' line: 25

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

* 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 4s


Please review your Gradle project setup in the android/ folder.

执行./android/gradlew返回确定!

leonardo@cintra:~/Github/apps-with-flutter/contador_de_pessoas$ ./android/gradlew
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Task :help 

Welcome to Gradle 4.4.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help

To see more detail about a task, run gradlew help --task <task>


BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed

请帮帮我!

2 个答案:

答案 0 :(得分:0)

已解决!

我遵循@ M.Ricciut https://stackoverflow.com/a/52947028/6899896

的方向

成功了!但是我给出了这个错误(You have not accepted the license agreements of the following SDK components)并解决了

答案 1 :(得分:0)

颤振本身就是问题所在。有关此问题的一些讨论:https://github.com/flutter/flutter/pull/23397

简而言之,在上述链接的Mahi-K之后,您必须编辑$flutterRoot/packages/flutter_tools/gradle/flutter.gradle

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

在gradle包装器属性gradle/wrapper/gradle-wrapper.properties中,您可能还必须将其更改为4.6或更高版本

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