androidfluttergradlebuild.gradlebintray

Flutter error : Could not resolve com.google.android.gms:play-services-location:16.+, Status code 502


Looks like Bintray library is down and I am not able to build my app. I tried a lot of solutions but none them worked. A similar github issue is there which is already closed without any proper help. Github link: https://github.com/flutter/flutter/issues/94400

This is the error I am getting :

Launching lib\main.dart on sdk gphone x86 arm in debug mode... Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.google.android.gms:play-services-location:16.+. Required by: project :app > project :location > Failed to list versions for com.google.android.gms:play-services-location. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml. > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

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.

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

android\build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
//        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
//        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

** flutter doctor -v **

[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19044.1348], locale en-US) • Flutter version 2.2.3 at C:\Users\PC\Documents\src\flutter • Framework revision f4abaa0735 (5 months ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\PC\AppData\Local\Android\sdk • Platform android-31, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = C:\Program Files\Android\Android Studio • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)

[√] VS Code (version 1.62.3) • VS Code at C:\Users\PC\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.25.0

[√] Connected device (3 available) • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.93 • Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.43

• No issues found!


Solution

  • All my codes were right, the only problem was the location package which I replaced with geolocator package. Now it's working fine.