when I try to build my flutter application I faced is problem:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. 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 resource '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 403 from server: Forbidden
I have tried everything but nothing works:
1- I have a stable internet connection
2- I have tried updating or downgrading com.android.tools.build:gradle version
3- I have tried cleaning caches
4- I have tried removing all firebase libraries
5- I replaced JCentre() with mavenCentral()
There is my android -> build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and here is my android build.gradle file:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "io.bujupah.hestia"
minSdkVersion 17
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.google.android.gms:play-services-auth:16.0.1'
testImplementation'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.17.0'
implementation 'com.android.support:multidex:1.0.3'
}
finally my flutter doctor result:
[√] Flutter (Channel unknown, 2.0.0, on Microsoft Windows [version 10.0.19042.1052], locale fr-TN) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.1) [√] Chrome - develop for the web [√] Android Studio (version 4.0) [√] VS Code (version 1.57.1) [√] Connected device (3 available)
• No issues found!
Account: https://bintray.com/google. Contact: emailremoved@ Bintray is a download center with REST automation & support for RPM & Debian packages. It is often used to distribute Android libraries via Maven or/and jCenter repositories.
JFrog, the maintainers of JCenter, announced that they are sunsetting JCenter. This means the following for Android developers for their app's dependencies: March 31st 2021 - Libraries in JCenter will no longer be updated. February 1, 2022 - JCenter will be completely shut down.
Your build may be affected by this shutdown in several ways: Gradle may not be able to download the dependencies used to compile, test or run your code. Gradle may not be able to download the dependencies used by plugins to configure your build.
After trying everything that I found on Google. It took me almost 3 days. I finally found a workaround for me:
Upgrade your gradle to the latest version. In android/build.gradle
file:
I edited classpath 'com.android.tools.build:gradle:3.6.3'
to classpath 'com.android.tools.build:gradle:4.2.0'
And in android/gradle/wrapper/gradle-wrapper.properties
file:
I edited distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
to distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
My project is working again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With