无法解析com.android.tools.build:gradle:3.2.1。扑

时间:2018-12-14 22:07:01

标签: android dart flutter

我想运行我的Flutter应用程序时遇到此错误。 我正在使用flutter 1.0.0版本和android studio 3.2.1版本。

我的模拟器是Pixel 2 android 8.1。

我也使用过android 9,但是它也不起作用。

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "E:\TUT\flutter\project\myfirstapp\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.2.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > jcenter.bintray.com
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > dl.google.com

* 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 27s
  Command: E:\TUT\flutter\project\myfirstapp\android\gradlew.bat app:properties

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

4 个答案:

答案 0 :(得分:2)

您需要将存储库google()添加到根项目的buildscript dependencies

文件可能是E:\TUT\flutter\project\myfirstapp\android\build.gradle

jcenter()存储库旁边;不能满足这种依赖性。

答案 1 :(得分:1)

enter image description here

如上图所示,您应该检查插件版本和必需的gradle版本。

用于检查插件版本:android-> build.gardle-> build         脚本->依赖关系-> calsspath
 咀嚼所需的漱口水         版本:android-> gradle-> wrappper-> gradle-wrapper.properties

答案 2 :(得分:1)

在通过Internet连接运行它之前,我一直遇到相同的错误,似乎它下载了必要的资源。

答案 3 :(得分:1)

如果您的计算机上未安装项目Gradle版本,请在编译前先尝试从Google服务器下载相应版本。

所以

  1. 确保您的计算机已连接到Internet。
  2. Google在某些国家/地区(例如伊朗,古巴,苏丹,叙利亚等)限制了对某些服务的访问。因此,请确保您的系统有权访问google developer子域。 (在受限制的国家/地区使用VPN)
  3. 或使用已安装的版本号在“ android \ build.gradle->依赖项”上更改项目Gradel版本