androidfluttergradlebintray

My flutter Android build broke all sudden with a gradle error, with no changes to the gradle configuration on my part


Out of the blue, I started getting the following build error when building my flutter app android version. The build was working fine, then all of a sudden, this error started occuring.

I have not changed my pubspec.yaml dependencies, and I have not changed any of my gradle config files. I have been using the current gradle configuration to build for a very long time without error. I am not sure how this error could just pop up without any changes to the build system.

I have researched this error, and it seems like many of the suggestions to fix it are to bump the gradle version in gradle-wrapper.properties. I have bumped the version from 5.6 to 6.7 to 7.2 all in attempt to fix this issue, and none of those changes worked. I ran flutter clean in between those changes.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve io.flutter:x86_64_debug:1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_64_debug:1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.
         > Could not get resource 'https://jcenter.bintray.com/io/flutter/x86_64_debug/1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6/x86_64_debug-1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.pom'.
            > Could not GET 'https://jcenter.bintray.com/io/flutter/x86_64_debug/1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6/x86_64_debug-1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.pom'. Received status code 502 from server: Bad Gateway
   > Could not resolve io.flutter:x86_debug:1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_debug:1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.
         > Could not get resource 'https://jcenter.bintray.com/io/flutter/x86_debug/1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6/x86_debug-1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.pom'.
            > Could not GET 'https://jcenter.bintray.com/io/flutter/x86_debug/1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6/x86_debug-1.0.0-890a5fca2e34db413be624fc83aeea8e61d42ce6.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 2m 22s

Solution

  • You can replace the jcenter() by mavenCentral() in your project level build.gradle:

    Before:

    buildscript {
        ext.kotlin_version = '1.6.10'
        repositories {
            google()
            jcenter()
        }
    
      allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    

    After:

    buildscript {
        ext.kotlin_version = '1.6.10'
        repositories {
            google()
            mavenCentral()
        }
    
      allprojects {
        repositories {
            google()
            mavenCentral()
        }
    }