Failed to resolve: com.google.firebase:firebase-core:16.0.1

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Failed to resolve: com.google.firebase:firebase-core:16.0.1



I'm trying to add firebase cloud storage to my app. Below is the app build.gradle. But it says:
Failed to resolve: com.google.firebase:firebase-core:16.0.1.
Why? There is no firebase-core in the dependencies at all.


apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.louise.udacity.mydict"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.google.cloud:google-cloud-storage:1.31.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
}

apply plugin: 'com.google.gms.google-services'





if you are using kotlin than: Replace: implementation 'com.google.firebase:firebase-core:16.0.0' with: kapt 'com.google.firebase:firebase-core:16.0.0' and your top level gradle file add classpath 'com.google.gms:google-services:4.0.1'
– Dilip
May 31 at 7:18




5 Answers
5



From the docs:



Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.



Add:


implementation 'com.google.firebase:firebase-core:16.0.0'



and in top level gradle file use the latest version of google play services:


classpath 'com.google.gms:google-services:4.0.1'



https://bintray.com/android/android-tools/com.google.gms.google-services



Just to add, also you need to add the google() repo in the top level gradle file, as specified in the firebase docs:


google()


buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}

allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}



https://firebase.google.com/docs/android/setup





I added firebase-core, but same error occurs. btw, I used firebase assistant in android studio to add firebase cloud.
– Louise L.
May 29 at 14:08





it also says: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: d.android.com/r/tools/update-dependency-configurations.html. But i double checked all build.gradle files. I'm using implementation instead of comple for all dependencies.
– Louise L.
May 29 at 14:10







clean and rebuild the project, what android version plugin are u using?
– Peter Haddad
May 29 at 15:47





yes, I tried "clean" and "rebuild", same result. What do you mean by "android version plugin"? So if I delete firebase-storage and firebase-auth dependencies, the error disappeared. Once adding the 2 dependencies back, it looks like something is forcing firebase-core to 16.0.1, then failed.
– Louise L.
May 29 at 15:58





oh, my "com.google.gms:google-services" was 3.XX, i just upgraded to 4.0.1, the problem solved. Thanks so much!!
– Louise L.
May 29 at 16:30



I get the same issue and i solved it by replacing :


implementation 'com.google.firebase:firebase-core:16.0.1'



to


implementation 'com.google.firebase:firebase-core:15.0.2'



and everything solved and worked well.



Since May 23, 2018 update, when you're using a firebase dependency, you must include the firebase-core dependency, too.


firebase-core



If adding it, you still having the error, trying to update the gradle plugin in your gradle-wrapper.properties to 4.5 version:


gradle-wrapper.properties


distributionUrl=https://services.gradle.org/distributions/gradle-4.5-all.zip



and resync the project.





I added firebase-core, but same error occurs. btw, I used firebase assistant in android studio to add firebase cloud.
– Louise L.
May 29 at 14:08





Still doesn't work....
– Louise L.
May 29 at 15:19





+--- com.google.firebase:firebase-core:16.0.0 -> 16.0.1 FAILED I tried to run gradle dependencies, and it displayed the entry above. Looks like it intentionally convert 16.0.0 (which i declared in build.gradle) to 16.0.1. Do you know why it happens and how to modify the settings?
– Louise L.
May 29 at 15:36





Same here. It is working just fine with 16.0.0, but fails when I upgrade to 16.0.1. I am using all the latest Android Gradle and GMS configurations, plus gradle 4.7. Any ideas?
– racs
Jul 5 at 2:23



I was able to solve the issue by following these steps-



1.) This error occurs when you didn't connect your project to firebase.
Do that from Tools->Firebase if you are using Android studio version 2.2 or above.



2.) Make sure you have replaced the compile with implementation in dependencies in app/build.gradle


compile


implementation


dependencies in app/build.gradle



3.) Include your firebase dependency from the firebase docs. Everything should work fine now



Add maven { url "https://maven.google.com" } to your root level build.gradle file


repositories {
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}




Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).


Would you like to answer one of these unanswered questions instead?

5 qC3twTLXnfSZ1D5cCU pg8ZG1E,jU6aFMQV hikPblnJ9yRLxOEJ X,ys
hZXLh1p,yZV4OZrP2opXyZ 0xza j3hgrj

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results