1.运行第一个flutter程序出现Could not resolve all artifacts for configuration ':classpath'.

第一次运行程序出现以下问题,随手记录一下

Launching lib/main.dart on 192.168.56.101:5555 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/Users/zhaozhiwen/Desktop/flutter_safe/android/gradlew" 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 download gradle.jar (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.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download builder.jar (com.android.tools.build:builder:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.2.1/builder-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.2.1/builder-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download tracker.jar (com.android.tools.analytics-library:tracker:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.2.1/tracker-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.2.1/tracker-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download shared.jar (com.android.tools.analytics-library:shared:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.2.1/shared-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.2.1/shared-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download crash.jar (com.android.tools.analytics-library:crash:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.2.1/crash-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.2.1/crash-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.2.1/lint-gradle-api-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.2.1/lint-gradle-api-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download gradle-api.jar (com.android.tools.build:gradle-api:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.2.1/gradle-api-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.2.1/gradle-api-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download databinding-compiler-common.jar (androidx.databinding:databinding-compiler-common:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.2.1/databinding-compiler-common-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.2.1/databinding-compiler-common-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download manifest-merger.jar (com.android.tools.build:manifest-merger:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.2.1/manifest-merger-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.2.1/manifest-merger-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download sdk-common.jar (com.android.tools:sdk-common:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.2.1/sdk-common-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.2.1/sdk-common-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download builder-test-api.jar (com.android.tools.build:builder-test-api:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.2.1/builder-test-api-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.2.1/builder-test-api-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download ddmlib.jar (com.android.tools.ddms:ddmlib:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.2.1/ddmlib-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.2.1/ddmlib-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download sdklib.jar (com.android.tools:sdklib:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.2.1/sdklib-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.2.1/sdklib-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.2.1/layoutlib-api-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.2.1/layoutlib-api-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download dvlib.jar (com.android.tools:dvlib:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.2.1/dvlib-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.2.1/dvlib-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download repository.jar (com.android.tools:repository:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.2.1/repository-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.2.1/repository-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download common.jar (com.android.tools:common:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/common/26.2.1/common-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/common/26.2.1/common-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download transform-api.jar (com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download jetifier-processor.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download bundletool.jar (com.android.tools.build:bundletool:0.5.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.5.0/bundletool-0.5.0.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.5.0/bundletool-0.5.0.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download jetifier-core.jar (com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-core/1.0.0-alpha10/jetifier-core-1.0.0-alpha10.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-core/1.0.0-alpha10/jetifier-core-1.0.0-alpha10.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download builder-model.jar (com.android.tools.build:builder-model:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.2.1/builder-model-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.2.1/builder-model-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download protos.jar (com.android.tools.analytics-library:protos:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.2.1/protos-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.2.1/protos-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download apkzlib.jar (com.android.tools.build:apkzlib:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.2.1/apkzlib-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.2.1/apkzlib-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download apksig.jar (com.android.tools.build:apksig:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.2.1/apksig-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.2.1/apksig-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download annotations.jar (com.android.tools:annotations:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.2.1/annotations-26.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.2.1/annotations-26.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download databinding-common.jar (androidx.databinding:databinding-common:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.2.1/databinding-common-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.2.1/databinding-common-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download baseLibrary.jar (com.android.databinding:baseLibrary:3.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.2.1/baseLibrary-3.2.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.2.1/baseLibrary-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)
> Could not download aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.217.251, dl.google.com/2a00:1450:400d:807:0:0:0:200e] failed: No route to host (connect failed)

* 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 4m 2s
Command: /Users/zhaozhiwen/Desktop/flutter_safe/android/gradlew app:properties

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

 

解决方法:

gradle中添加:

maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

注释掉:

// google()

// jcenter()

 

好了,编译成功,可以运行了!

 

posted @ 2019-06-13 10:22  秋叶飘渺  阅读(2756)  评论(0编辑  收藏  举报