运行Gradle时出错[无法解析所有工件以进行配置]

时间:2019-08-12 12:26:05

标签: gradle flutter dart build.gradle

我尝试运行Flutter项目,但出现此错误

我使用Flutter 1.7.8 然后在pubspec.yml中添加以下依赖项:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2

  http: ^0.12.0
  sqflite: ^1.1.6
  path_provider: ^0.4.1

当我尝试运行时,出现打击错误,如何修复主题?

Error running Gradle:
ProcessException: Process "/home/zagros/Projects/flutter/flutter-example/news/android/gradlew" exited abnormally:

> Configure project :path_provider

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

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':path_provider'.
> Could not resolve all artifacts for configuration ':path_provider:classpath'.
   > Could not find builder.jar (com.android.tools.build:builder:3.1.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.1.2/builder-3.1.2.jar
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/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 0s
  Command: /home/zagros/Projects/flutter/flutter-example/news/android/gradlew app:properties

1 个答案:

答案 0 :(得分:0)

我解决了问题

首先,在将依赖项1.7.8+hotfix.4更改为1.7.8+hotfix.3之后,我将Flutter SDK格式sqflite: ^1.1.6降级为sqflite: ^1.1.0,最后建立了高质量的VPN连接。

该错误已修复,并且Gradle可以成功构建。