user17550050
user17550050

Reputation: 41

Flutter - Build failed with an exception

When I launched my app, I got this error message. I did not make any changes since last run, when everything was fine. Does anybody know how to solve this? Thank you.

FAILURE: Build failed with an exception.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not resolve io.grpc:grpc-core:[1.28.0]. Required by: project :app > project :cloud_firestore > com.google.firebase:firebase-firestore:22.1.2 > io.grpc:grpc-android:1.28.0 project :app > project :cloud_firestore > com.google.firebase:firebase-firestore:22.1.2 > io.grpc:grpc-okhttp:1.28.0 > Failed to list versions for io.grpc:grpc-core. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/io/grpc/grpc-core/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/io/grpc/grpc-core/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/io/grpc/grpc-core/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

BUILD FAILED in 6s Exception: Gradle task assembleDebug failed with exit code 1

Upvotes: 3

Views: 3148

Answers (3)

Theodore MCA
Theodore MCA

Reputation: 1178

Follow these three steps

1. flutter pub cache repair.

2. flutter Clean.

Finally and the most important

3. Modify the build.gradle file as below change jcenter() to mavenCentral() everywhare

Before

 repositories {
        google()
        jcenter()
 }

After

 repositories {
        google()
        mavenCentral()
 }

Good luck.

Upvotes: 1

Sergey Salnikov
Sergey Salnikov

Reputation: 1791

Basic problem that version of io.grpc:grpc-core:[1.28.0] is not specified strictly and gradle have to find possible versions but google.bintray.com is down - no version listing available

  1. Find what version is - this [1.28.0] mean it has versions range Gradle Declaring Versions and Ranges

  2. The [ and ] symbols indicate an inclusive bound with only one version - so consider take exactly 1.28.0

  3. Constrain your transitive dependency with maximum possible version 1.28.0

Edit your project app/build.gradle:

dependencies {
  ...
  constraints {
    implementation('io.grpc:grpc-core') {
        version {
            strictly '1.28.0'
        }
    }
  }
}

Upvotes: 1

Leonardo Castro
Leonardo Castro

Reputation: 56

The solution I founded was upgrade all my packages.

flutter pub upgrade --major-versions

After treat all the issues and problems.

Upgrade the kotlin version too.

from ext.kotlin_version = '1.3.50' to ext.kotlin_version = '1.4.32'

Or the latest Kotlin version.

Try to run your project again.

Upvotes: 4

Related Questions