Flutter:Gradle任务assembleDebug失败(配置根项目“ android”)

时间:2020-03-26 20:53:36

标签: android android-studio flutter gradle dart

我在Windows 10上使用Android Studio 3.6.1 (我是新手,这是我的第一次尝试)

您可以在这里看到我的“扑打医生”结果(所有检查): flutter doctor command result

不幸的是,当我想运行程序时,发生此错误: android studio error

文本:

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.5.0.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.5.0.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
               > Connect to 127.0.0.1:2347 [/127.0.0.1] failed: Connection refused: connect
      > Could not resolve com.android.tools.build:gradle:3.5.0.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
               > Connect to 127.0.0.1:2347 [/127.0.0.1] failed: Connection refused: 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 20s
Finished with error: Gradle task assembleDebug failed with exit code 1

我尝试了Stack Overflow,YouTube和中型平台上的所有文章,但仍然遇到问题:(

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题;

Delete all files in .gradle folder and reopen Android studio to re-download and update to the latest files.
PATH: C:\Users\<YOUR-USER-NAME>\.gradle

这对我有用。希望对您有所帮助,然后重新运行Flutter Doctor命令