Gradle threw an error while downloading artifacts from the network. Retrying to download... in android studio

658

As it says in stack trace, try to download dependencies from url https://google.bintray.com/ but get 502 http error. if you test this link on browser you'll get this error too. Refer to this link this might be temporary error from the repository.

you can also replace all your jcenter() from your repository closure in build.gradle with mavenCentral(). sync Gradle and build again.

Share:
658
Shashiwadana
Author by

Shashiwadana

Undergraduate in Information Technology field.

Updated on November 23, 2022

Comments

  • Shashiwadana
    Shashiwadana over 1 year

    When I try to build android app I get this error:

    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...
    

    I'm using Mac OS, flutter and android studio. I can build iOS app without any such error.How can I fix this?

    I tried this one,

    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
    

    But still I get the same error.

    this is my android/build.gradle file: enter image description here

  • Shashiwadana
    Shashiwadana over 2 years
    It already has mavenCentral()
  • Mahdi Yusefi
    Mahdi Yusefi over 2 years
    @Shashiwadana Could you post both your build.gradle? (I mean both root and app module .gradle). As I know if you had set all your repository to maven central it wouldn't try to download from this link.
  • Shashiwadana
    Shashiwadana over 2 years
    I added root build.gradle file
  • Mahdi Yusefi
    Mahdi Yusefi over 2 years
    @Shashiwadana you have all projects{ .... maven {url 'https://google.bintray.com/exoplayer'} } And you may try to resolve one of exoplayer dependencies which is not in mavenCentral so Gradle pass this repository to google bintray and google.binray.com is temporary down. check this link(stackoverflow.com/questions/69318147/…) and try to find suitable version of exoplayer in mavenCentral or wait till problem in google bintray being solved.