Yesterday I tried building my app and everything worked fine.
Today, without any changes to the project... All of a sudden I\'m greeted with this warning message tel
jcenter() has had mirrors of some libraries (I guess they are doing intentionally) that should originally available through google() or maven() repositories. When gradle build works, for any library that is used in the project the first place to look for is the repository that is listed first in repositories {..
When the jcenter() mirror does not have the release (e.g com.google.android.gms:play-services-ads:15.0.1 for my case) your gradle is looking for, the build fails with such error.
So, jcenter() should be listed at the last place in repositories {..
parts as below.
buildscript {
ext.kotlin_version = '1.2.50'
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}...
and
allprojects {
repositories {
google()
jcenter()
}
}
This is crazy!!! I faced the same issue. The builds were working fine and then suddenly started to fail with the same issue. I tried the suggestions above but it didn't work for me. Finally, this is what worked for me:
Update to latest firebase dependencies:
implementation 'com.google.firebase:firebase-core:16.0.4' implementation 'com.google.firebase:firebase-ads:17.0.0'
also, the ads services:
implementation 'com.google.android.gms:play-services-ads:17.0.0'
Note: with play-services-ads:17.0.0, it mandatory to add the following in the Manifest file, otherwise application crashes on opening.
<application> <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 --> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="[ADMOB_APP_ID]"/> </application>
In my case just added www
earlier url was like url "https://jitpack.io/"
after this added www
started working for me. In other repositories also try to add explicit URLs.
maven {
url "https://www.jitpack.io/"
}
Had same issue, for me none of the answers mentioned here worked. So I just updated dependencies in the gradle file and whichever dependency had com.google.gms: (kept them at same version example 16.0.0)
UPDATE #2 2018/05/29
The issue looks to be fixed gone now, and I'm still using the same gradle configs. But I did these steps a while ago I'm not sure if these did anything or if this is a server-side issue and it got fixed/updated recently. I just noticed the issue was gone after I did the following steps:
Add the following in project-level gradle.build's
buildscript > repositories
andallprojects > repositories
.
google()
maven { url 'http://jcenter.bintray.com' }
Change the google-services classpath to
classpath com.google.gms:google-services:4.0.1'
Sync Project with Gradle Files
UPDATE #1 2018/05/29
I got around the error by downgrading my firebase dependencies to ~12.0.0 in the app-level gradle. But this will severly impact the app, still looking around for more feasible workarounds.
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
...
compile 'com.google.firebase:firebase-core:12.0.0'
compile 'com.google.firebase:firebase-database:12.0.0'
compile 'com.google.firebase:firebase-storage:12.0.0'
compile 'com.google.firebase:firebase-auth:12.0.0'
compile 'com.google.firebase:firebase-crash:12.0.0'
...
Same here, I have experienced the same issue described by @SimbaClaws. Everything was compiling smoothly until I faced the same issue yesterday.
I have the following codes in my project-level build.gradle,
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the following codes for the app-level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "my.secret.application"
minSdkVersion 16 // 19
targetSdkVersion 26
versionCode 1
versionName "5.0.204"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.google.firebase:firebase-storage:15.0.2'
compile 'com.google.firebase:firebase-auth:15.1.0'
compile 'com.google.firebase:firebase-crash:15.0.2'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.android.support:palette-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'org.greenrobot:eventbus:3.1.1'
testCompile 'junit:junit:4.12'
compile 'com.crashlytics.sdk.android:crashlytics:2.9.1'
}
apply plugin: 'com.google.gms.google-services'
Can anyone advise if I missed anything? I'm also still looking around for possible workarounds and answers. TIA!
I have also experienced this issue. The root cause, I found out was that there inconsistent build Gradle version. In the Gradle Scripts repository "if I can call it that " there are two build gradle modules. The build.gradle (Project: name of app) and the build.gradle (Module: app). Make sure that classpath 'com.android.tools.build:gradle:3.2.1' in dependencies is using the latest and same version of the tool. Inconsistencies result in issues with the build.