简体   繁体   English

> 无法解析 com.android.tools.build:gradle:3.5.0

[英]> Could not resolve com.android.tools.build:gradle:3.5.0

I have this error when I built flutter project:我在构建 flutter 项目时遇到此错误:

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: A problem occurred configuring root project 'android'.出了什么问题:配置根项目“android”时出现问题。

Could not resolve all artifacts for configuration ':classpath'.无法解析配置“:classpath”的所有工件。 Could not resolve com.android.tools.build:gradle:3.5.0.无法解析 com.android.tools.build:gradle:3.5.0。 Required by: project: > Could not resolve com.android.tools.build:gradle:3.5.0.要求:项目:> 无法解析 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'. > 无法获取资源“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'. > 无法获取“https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom”。 > YOUR_HOST > Could not resolve com.android.tools.build:gradle:3.5.0. > YOUR_HOST > 无法解析 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'. > 无法获取资源“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'. > 无法获取“https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom”。 > YOUR_HOST > Could not resolve com.android.tools.build:gradle:3.5.0. > YOUR_HOST > 无法解析 com.android.tools.build:gradle:3.5.0。 > Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'. > 无法获取资源“https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom”。 > Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'. > 无法获取“https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom”。 > YOUR_HOST Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50. > YOUR_HOST 无法解析 org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50。 Required by: project: > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.要求:项目:> 无法解析 org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50。 > Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > 无法获取资源“https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom” . > Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > 无法获取“https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom”。 > YOUR_HOST > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50. > YOUR_HOST > 无法解析 org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50。 > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > 无法获取资源“https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom”。 > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > 无法获取“https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom”。 > YOUR_HOST > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50. > YOUR_HOST > 无法解析 org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50。 > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > 无法获取资源'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.po。 > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. > 无法获取'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50'.po。 > YOUR_HOST > 你的主机

  • Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.运行 --scan 以获得完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获得更多帮助

BULD FAILED in 3s BULD 在 3 秒内失败

Exception: Gradle task assembly debug failed with exit code 1异常:Gradle 任务程序集调试失败,退出代码为 1

This kind of issue usually appears either due to a gradle misconfig or in your case, it looks more of an internet issue.这种问题通常是由于 gradle 配置错误,或者在您的情况下,它看起来更像是互联网问题。

Try running flutter clean in your project source and then using flutter build appbundle and check whether you're able to run the command without any errors.尝试在您的项目源中运行flutter clean ,然后使用flutter build appbundle并检查您是否能够运行该命令而没有任何错误。

In case, you're still facing any errors, go to android/build.gradle in your flutter project and edit this line如果您仍然遇到任何错误,请在 flutter 项目中将 go 到android/build.gradle并编辑此行

from classpath 'com.android.tools.build:gradle:3.5.0'classpath 'com.android.tools.build:gradle:3.5.0'

to classpath 'com.android.tools.build:gradle:3.4.2classpath 'com.android.tools.build:gradle:3.4.2

Then repeat the above steps again with flutter clean and flutter build appbundle .然后使用flutter cleanflutter build appbundle再次重复上述步骤。 It should work.它应该工作。

run Flutter upgrade first先运行Flutter升级

flutter upgrade

then run flutter clean然后运行 flutter clean

flutter clean

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM