I am integrating Firebase messaging for a version. It is:
'com.google.firebase:firebase-messaging:15.0.2'
My classpath is:
classpath 'com.google.gms:google-services:3.2.0'
I had faced the following error:
Failed to resolve: firebase-messaging Open File
Change this:
classpath 'com.google.gms:google-services:3.2.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
into this:
classpath 'com.google.gms:google-services:4.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
Explanation:
Here in this case using firebase-messaging:15.0.2 with google-services:4.0.1 would work, since the most important thing was updating google-services above 3.2.0, and that's because google-services:3.3.0 is needed to be able to use the firebase library from version 15.0 and above. You can check this blog post. that explains the changes in versioning of firebase libraries.
But it is still better to update the google-services plugin to prevent any other errors with other dependencies.
Note:
The versions less than 15.0.0 are in google maven repository, so you can use them in gradle. But, you cannot mix version 15.0.0 with a version less than 15.0.0 and use google play services 4.0.1, as said in my answer here. That's why it is better to update firebase libraries to the latest versions.
According to the Guy4444 1 on the post 2 I have changed
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
to
implementation 'com.google.firebase:firebase-messaging:17.0.0'
and it solved the problem!
I got it resolved by changing
this
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
to this
implementation 'com.google.firebase:firebase-messaging:17.0.0'
Related
How to resolve this error!
"Failed to resolve: com.google.firebase:firebase-messaging:16.0.5"
Firebase dependencies version is 16.0.5, I switch and play with some other versions also, still have the error.
def Firebase_version = "16.0.5"
implementation "com.google.firebase:firebase-auth:$Firebase_version"
implementation "com.google.firebase:firebase-messaging:$Firebase_version"
Am using latest version of classpath
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.2'
And repositories
google()
jcenter()
Both are added:
Android Studio : 3.2.1
firebase-messaging 16.0.x version seems unavailable, That why we
getting the error
"Failed to resolve: com.google.firebase:firebase-messaging:16.0.5"
In order to fix it keep the other 16.0.x versions as it is
and upgrade 17.x.x versions to the latest
code is given below
def Firebase_Auth_Version = "16.0.5"
def Firebase_Messaging_Version = "17.3.4"
implementation "com.google.firebase:firebase-messaging:$Firebase_Messaging_Version"
implementation "com.google.firebase:firebase-auth:$Firebase_Auth_Version"
To solve this, please change the following lines of code:
implementation "com.google.firebase:firebase-auth:$Firebase_version"
implementation "com.google.firebase:firebase-messaging:$Firebase_version"
to
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
And add:
implementation 'com.google.firebase:firebase-core:16.0.4'
Which is now mandatory in order to make Firebase work.
Disable Gradle offline and re-syncing worked for me.
What actually was missing for me and what made it work was 'Google Play services'
Go to: Settings -> Android SDK -> SDK Tools -> check/install Google Play services.
Hope it helps.
You need to add this dependencies as well.
implementation 'com.google.firebase:firebase-core:16.0.5'
Try by adding above dependencies.
Try this
implementation "com.google.firebase:firebase-messaging:17.3.4"
Try this in the app gradle file:
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.5'
I am new to android development environment and I need to connect my app to firebase but I am getting this error
Failed to resolve: firebase-auth-15.0.0
This error is shown in the statement:
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
This statement contain details of two versions, I think the error is caused due to this, but this particular statement is provided by firebase itself. See the image:
I tried to change the above statement to
implementation 'com.google.firebase:firebase-auth:16.0.3'
But then firebase dependency is not setting up.
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
Replace the above one with
implementation 'com.google.firebase:firebase-auth:16.0.1'
Instead of:
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
Insert these two lines:
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.6'
Warnings should disappear
Try to use only implementation 'com.google.firebase:firebase-auth:16.0.1' in your code.
In your root build.gradle file add the repo:
allprojects {
repositories {
google()
jcenter()
// ...
}
}
Check if your firebase core is the same version than your firebase auth
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
and in your classpath an up version of 3.0.0
classpath 'com.android.tools.build:gradle:3.0.1' //up of this version
check this page to be up to date with firebase version:
https://firebase.google.com/support/release-notes/android#latest_sdk_versions
Try This add the dependency for Authentication to your app-level build.gradle file
implementation 'com.google.firebase:firebase-auth:16.0.3'
Worked with me, follow me.
I had this same problem. In the implementation of dependencies they are with the implementation 'com.google.firebase: firebase-auth: 16.0.2' ". The first is usually implemented manually and the second when we click the add button authentication with Firebase by the console in Android Studio and that is where the error begins. This button does not need to be triggered to authenticate the app. Just the first button to Connect with Firebase.
In the build.gradle file, keep only one Auth dependency.
Add firebase-core dependency and the latest versions of dependencies from this page:
fire base libraries
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'`
Replace the above with this -->
implementation 'com.google.firebase:firebase-auth:16.0.1'
I had the same problem. I updated the Android Studio and the Gradle ,it seems to work fine now
i'm learning Android while doing some work on it. I'm trying to update an app's version to Android 8.0, that includes sdk, libraries and external APIs used.
I looked it up and it seems like 15.0.1 is the suggested version. But when i use it, gradle fails for play-services-analytics and firebase services to sync saying it cannot resolve the library and nor can it find the Repository if i press Install Repository.
So currently i'm using version 12.0.1 for both play services and firebase services. Using it like:
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-analytics:12.0.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-analytics:12.0.1'
implementation 'com.google.firebase:firebase-crash:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
But if i try to use only the play-services 15.0.1 except for analytics then it gives me another warning that using different versions of play services and firebase services can lead to runtime crashes.
So it puts me in a weird situation, i've googled and searched, but cant find anything that works for me... What would be the correct way to deal with this here? Should i settle for 12.0.1? or update what ever works? (Previously the version was 9.4.0 or something along that line; before i was doing the Android 8.0 upgrade)
EDIT: These are my top level gradle dependencies
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
You cannot mix versions of firebase and google play services that are less than or equal to 12 with versions that are greater than or equal to 15.
Therefore you need to update the version number of all these libraries:
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-analytics:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
Check this:
https://firebase.google.com/support/release-notes/android
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Beginning with version 15, each Maven dependency matching com.google.android.gms:play-services-* and com.google.firebase:firebase-* is no longer required to have the same version number in order to work correctly at build time and at run time.
Also use the following google play services plugin in the top level gradle file:
classpath 'com.google.gms:google-services:4.0.1'
As per this SO thread, I know there are version conflicts, but issue still persists after new versions from Google.
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.1.
My build.gradle(Module: app)
....
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.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
}
apply plugin: 'com.google.gms.google-services'
What changes are required now?
I think you change
compile 'com.google.firebase:firebase-messaging:11.0.4'
Same error gets thrown when
apply plugin: 'com.google.gms.google-services'
is not added to bottom of the module build.gradle file.
You must use only one version for all 3 libs
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
OR only use only 10.0.1 for 3 libs
Please change your project-level build.gradle file in which you have to change your dependencies class path of google-services or build.gradle path.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
}
}
The google play services requires all its dependencies to have the same version. But if you look at your dependencies:
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
There is one that has a different version.
It can be solved by changing the version to (in this case) 11.0.4.
This applies to both Firebase and Google Play Services - both have to have matching versions that also correspond with each other. If a Firebase dependency is 10.0.1 and a Google Play Services dependency is 11.0.4, the same error will occur.
Note that in some cases, there can be a library that has a different version of a library (e.g. library x uses play-services-games:10.0.1 while you use 11.0.4 for the dependencies in your app)
Edit
This answer does NOT cover the newer versions where versions are individual. Update com.google.gms:google-services:4.1.0 and check mvnrepository (or some other maven/gradle artifact search tool) to find the newest versions.
With
com.android.tools.build:gradle:3.2.0
You have to use:
classpath 'com.google.gms:google-services:4.1.0'
This fixed my problem
For fire base to install properly all the versions of the fire base compiles must be in same version so
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
this is the correct way to do it.
Initially, the firebase database was pointing to 11.8.0 .after changing all the related jars to 11.0.4 this issue is resolved at changes the SDK level.
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
Important Update
Both Firebase & Play-service dependencies are having independent versions unlike past. If
you have version conflicts then you can update your
com.google.gms:google-services. and start defining independent version.
Step(1): Update com.google.gms:google-services
Open project level build.gradle and update com.google.gms:google-services to version 4.1.0 MUST CHECK newer if available.
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0' //< update this
}
}
Step(2): Update Firebase dependencies Latest Versions
Firebase dependency versions can be individual.
com.google.firebase:firebase-core:16.0.3 //Analytics, check latest too
com.google.firebase:firebase-database:16.0.2 //Realtime Database, check latest too
Step(3): Update Play Services dependencies Latest Versions
Play services versions also can have individual versions.
com.google.android.gms:play-services-ads:17.1.2 //Ads, check latest too
com.google.android.gms:play-services-analytics:16.0.6 //Analytics, check latest too
Still having issue?
You can check which dependency is making conflict by reading this answer.
Update google services and Firebase library to latest version
google services
classpath 'com.google.gms:google-services:4.3.1'
firebase
implementation 'com.google.firebase:firebase-database:19.0.0'
as the message says go to:
com.google.gms.google-services versions
And copy the last version's number . Mine was less than 3.3.1.
Then in project's build.gradle put/change dependencies node as :
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2' // as it was before
classpath 'com.google.gms:google-services:3.3.1' // <-- the version change
}
Then I synced the project and error went
All google services should be of same version, try matching every versions.
Correct one is :
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
Incorrect Config is :
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
After All Working for 6 hours i got the solution...
Simple Just what ever the plugins you defined in the build.gradle file... for ex: google services plugins or firebase plugins or any third party plugins all the **version code** should be same..
Example: In my application i am using following plugins...
// google services plugins
implementation 'com.google.android.gms:play-services-analytics:10.0.1'
implementation 'com.google.android.gms:play-services-gcm:10.0.1'
implementation 'com.google.android.gms:play-services-base:11.6.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:11.6.0'
//firebase plugin
implementation 'com.google.firebase:firebase-ads:10.0.1'
//Third Party plugin
implementation 'com.google.android.gms:play-services-auth:16.0.0'
In the above plugins version code(ex:10.0.1, 16.0.0, 11.6.1) are different I was facing fix the version conflict (google-services plugin) issue
Below for all plugins i have given single version code(11.6.0) and the issue is resovled...
// google services plugins
implementation 'com.google.android.gms:play-services-analytics:11.6.0'
implementation 'com.google.android.gms:play-services-gcm:11.6.0'
implementation 'com.google.android.gms:play-services-base:11.6.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:11.6.0'
//firebase plugin
implementation 'com.google.firebase:firebase-ads:11.6.0'
//Third Party plugin
implementation 'com.google.android.gms:play-services-auth:11.6.0'
**Syn Gradle**...
Go to Build>>Rebuild Projcet...
Sure it will work....#Ambilpura
install or update google play services. Secondly, check your 'com.google.gms:google-services:3.0.0' version . Check , this by upgrading it if still not work to 3.1.0
Why am I getting this error? My repository and Google play services are up to date and I've used all the requires steps for using Firebase like copying firebase code in both build.gradle(Project and app). The intellisence doesn't even show FirebaseAuth but displays other members of Firebase.
Solved the error by adding this to the build.gradle file(for app) -
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
The 2nd dependency is to solve the version conflict error.
Add this dependency to Gradle.Build(Module:App)
compile "com.google.firebase:firebase-auth:9.0.2"
then sync with gradle :)
Add these two dependencies into your build.gradle
as 'compile' is replaced by 'implementation'
dependencies {
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation "com.google.android.gms:play-services-gcm:16.0.0"
}
***For the latest android studio version 3.0 and new ones ***
Same problem. Clean your project with "Build"->"Clean Project".
add the following to the build.gradle (app)
implementation 'com.google.firebase:firebase-auth:9.2.1'
For me this worked with all the firebase extensions:
eg.:
Android studio adds the following line to your gradle file:
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
You have to change it to:
implementation 'com.google.firebase:firebase-auth:16.0.1'
and add:
kapt 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
I have android studio 3.3.1 installed. Compile is replaced with implementation. So you have to write
implementation 'com.google.firebase:firebase-auth:16.1.0'
You should replace version according to the warning you get.
on dependencies in app gradle
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
this is useful android 3.0 and onwards versions auth:16.0.1 and
core:16.0.1Firebase will work
Solved the error by adding this to the build.gradle file(for app) -
compile 'com.google.firebase:firebase-auth:9.2.1'
compile "com.google.android.gms:play-services-gcm:9.2.1"
You may need to make sure that your activity is importing the Firebase Auth module. In your .java file (eg. Login.java):
import com.google.firebase.auth.FirebaseAuth;
Please add the below line in your build.gradle file:
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation "com.google.android.gms:play-services-gcm:10.2.1"
In my case, I was using firebase-auth and firebase-messaging with different versions. So After getting an error I kept the same version for both e.g.
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
After sync, my problem was solved. try to keep the version the same for firebase libraries
implementation 'com.google.firebase:firebase-auth:16.0.1'
make sure your firebase and all the dependency are the same versions.