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

3

2

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
Alcyone answered 12/1, 2022 at 21:18 Comment(0)
W
2

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()
    }
}
Watercolor answered 16/1, 2022 at 12:34 Comment(0)
M
0

I also faced this issue a few hours ago. I was using the latest Flutter SDK 2.8.1. I looked for solutions and tried many things. Updated all the plugins, Gradle version but nothing worked.

Then I just downgraded Flutter to 2.5.3 and it's working fine now.

I think this is an issue in Flutter's latest version, or maybe there's some issue in the jcenter site.

However, downgrading might be a workaround for now, I hope the flutter team will solve this asap.

Meisel answered 12/1, 2022 at 21:52 Comment(0)
S
0

Even though its marked deprecated and sunset, jcenter will remain a read depo indefinitely. It could be that your dependency is on bintray or possibly that gradle itself has dropped support. You might need to find an alternative.

https://blog.gradle.org/jcenter-shutdown

UPDATE: JFrog has decided to keep JCenter as a read-only repository indefinitely. New package and versions are no longer accepted on JCenter. All Bintray services have been shutdown.

Sink answered 12/1, 2022 at 23:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.