1、Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:x.x.x
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> Could not resolve all files for configuration ':classpath'.
> Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.3-2)
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download kotlin-stdlib.jar (org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2)
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download protobuf-java.jar (com.google.protobuf:protobuf-java:3.0.0)
> Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'.
> Could not GET 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download bcpkix-jdk15on.jar (org.bouncycastle:bcpkix-jdk15on:1.56)
> Could not get resource 'https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar'.
> Could not GET 'https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56)
> Could not get resource 'https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar'.
> Could not GET 'https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download fastutil.jar (it.unimi.dsi:fastutil:7.2.0)
> Could not get resource 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
> Could not GET 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download ecj.jar (org.eclipse.jdt.core.compiler:ecj:4.6.1)
> Could not get resource 'https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar'.
> Could not GET 'https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download jimfs.jar (com.google.jimfs:jimfs:1.1)
> Could not get resource 'https://jcenter.bintray.com/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar'.
> Could not GET 'https://jcenter.bintray.com/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download lombok-ast.jar (com.android.tools.external.lombok:lombok-ast:0.2.3)
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download guava.jar (com.google.guava:guava:22.0)
> Could not get resource 'https://jcenter.bintray.com/com/google/guava/guava/22.0/guava-22.0.jar'.
> Could not GET 'https://jcenter.bintray.com/com/google/guava/guava/22.0/guava-22.0.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download antlr4.jar (org.antlr:antlr4:4.5.3)
> Could not get resource 'https://jcenter.bintray.com/org/antlr/antlr4/4.5.3/antlr4-4.5.3.jar'.
> Could not GET 'https://jcenter.bintray.com/org/antlr/antlr4/4.5.3/antlr4-4.5.3.jar'.
> d29vzk4ow07wi7.cloudfront.net
> Could not download juniversalchardet.jar (com.googlecode.juniversalchardet:juniversalchardet:1.0.3)
> Could not get resource 'https://jcenter.bintray.com/com/goo...rsalchardet/1.0.3/juniversalchardet-1.0.3.jar'.
> Could not GET 'https://jcenter.bintray.com/com/goo...rsalchardet/1.0.3/juniversalchardet-1.0.3.jar'.
> d29vzk4ow07wi7.cloudfront.net
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 1s
]
解决办法:
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
//替换为阿里镜像地址
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url "https://storage.googleapis.com/download.flutter.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
//替换为阿里镜像地址
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url "https://storage.googleapis.com/download.flutter.io" }
}
}
2、flutter-安卓端运行Could not resolve all artifacts for configuration ‘classpath’
Finished with error: Please review your Gradle project setup in the android/ folder.
* Error running Gradle:
ProcessException: Process "/Users/../Desktop/flutter_app/android/gradlew" exited abnormally:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/../Desktop/flutter_app/android/app/build.gradle' line: 25
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/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: /Users/../Desktop/flutter_app/android/gradlew app:properties`
解决方法:
找到放置flutter sdk的目录,打开flutter->packages->flutter_tools->gradle->flutter.gradle
修改内容
buildscript {
repositories {
google()
mavenCentral() //补充一行
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}