如何使用Flutter 2019修复错误Gradle

时间:2019-05-04 16:36:59

标签: flutter-test

* Error running Gradle:
ProcessException: Process "C:\Users\chhor\Documents\flutterApps\helloplant\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://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'.
               > Connect to 192.168.0.2:80 [/192.168.0.2] failed: Connection timed out: connect
      > 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'.
               > Connect to 192.168.0.2:80 [/192.168.0.2] failed: Connection timed out: connect
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > Connect to 192.168.0.2:80 [/192.168.0.2] failed: Connection timed out: connect

* 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 4s
  Command: C:\Users\chhor\Documents\flutterApps\helloplant\android\gradlew.bat app:properties


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

1 个答案:

答案 0 :(得分:0)

To solve this problem, add 

maven {
    url 'https://dl.google.com/dl/android/maven2'
}

in the top of:

jcenter()

and it will give that :

buildscript {
    repositories {
        google()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        jcenter()
    }