【问题标题】:Gradle threw an error while downloading artifacts from the network. Retrying to download... in android studioGradle 在从网络下载工件时抛出错误。正在重试下载...在 android studio
【发布时间】:2022-01-14 14:26:47
【问题描述】:

当我尝试构建 android 应用程序时出现此错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processTESTDebugResources'.
> Could not resolve all task dependencies for configuration ':app:TESTDebugRuntimeClasspath'.
   > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.
     Required by:
         project :app
      > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.
         > Could not get resource 'https://google.bintray.com/exoplayer/io/flutter/arm64_v8a_debug/1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8/arm64_v8a_debug-1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.pom'.
            > Could not GET 'https://google.bintray.com/exoplayer/io/flutter/arm64_v8a_debug/1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8/arm64_v8a_debug-1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.pom'. Received status code 502 from server: Bad Gateway
   > Could not resolve io.flutter:x86_debug:1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_debug:1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.
         > Could not get resource 'https://google.bintray.com/exoplayer/io/flutter/x86_debug/1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8/x86_debug-1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.pom'.
            > Could not GET 'https://google.bintray.com/exoplayer/io/flutter/x86_debug/1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8/x86_debug-1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.pom'. Received status code 502 from server: Bad Gateway
   > Could not resolve io.flutter:x86_64_debug:1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_64_debug:1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.
         > Could not get resource 'https://google.bintray.com/exoplayer/io/flutter/x86_64_debug/1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8/x86_64_debug-1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.pom'.
            > Could not GET 'https://google.bintray.com/exoplayer/io/flutter/x86_64_debug/1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8/x86_64_debug-1.0.0-40a99c595137e4b2f5b2efa8ff343ea23c1e16b8.pom'. Received status code 502 from server: Bad Gateway

* 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 7m 30s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...

我正在使用 Mac OS、flutter 和 android studio。我可以在没有任何此类错误的情况下构建 iOS 应用程序。我该如何解决这个问题?

我试过这个,

Go to flutter_app => android => gradle => wrapper directory
Delete gradle-wrapper.jar file
Open and edit gradle-wrapper.properties file
Change distributionUrl=https://services.gradle.org/distributions/gradle-x.x.x-all.zip to gradle-7.2-all.zip or latest
On terminal use flutter run command

但我仍然遇到同样的错误。

这是我的 android/build.gradle 文件:

【问题讨论】:

    标签: android flutter android-studio gradle


    【解决方案1】:

    正如堆栈跟踪中所说,尝试从 url https://google.bintray.com/ 下载依赖项,但得到 502 http error。如果您在浏览器上测试此链接,您也会收到此错误。请参阅此 link 这可能是存储库中的临时错误。

    您还可以将 build.gradlerepository 闭包中的所有 jcenter() 替换为 mavenCentral()。同步 Gradle 并重新构建。

    【讨论】:

    • 它已经有 mavenCentral()
    • @Shashiwadana 你能发布你的 build.gradle 吗? (我的意思是根和应用模块.gradle)。据我所知,如果您已将所有存储库设置为 maven Central,它将不会尝试从此链接下载。
    • 我添加了根 build.gradle 文件
    • @Shashiwadana 你有all projects{ .... maven {url 'https://google.bintray.com/exoplayer'} } 并且你可以尝试解决一个不在mavenCentral 中的exoplayer 依赖项,所以Gradle 将此存储库传递给google bintray 并且google.binray.com 暂时关闭。检查此链接(stackoverflow.com/questions/69318147/…) 并尝试在mavenCentral 中找到合适的 exoplayer 版本或等待 google bintray 中的问题得到解决。
    猜你喜欢
    • 2021-01-18
    • 2020-09-11
    • 2018-12-07
    • 1970-01-01
    • 2017-02-21
    • 2021-04-09
    • 2015-02-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多