The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.0.0,17.0.0]], but resolves to 16.2.0

AndroidReact NativeAndroid Gradle-PluginGoogle Play-ServicesReact Native-Android

Android Problem Overview


I started to get this error today, yesterday everything worked fine, there was no changes in gradle or firebase version

> The library com.google.firebase:firebase-iid is being requested by > various other libraries at [[17.0.0,17.0.0]], but resolves to 16.2.0. > Disable the plugin and check your dependencies tree using ./gradlew > :app:dependencies.

I saw that yesterday was update in google-services plugin, probably that is causing the problem.

How to fix this problem?

Android Solutions


Solution 1 - Android

I had the same issue. A quick fix would be to disable the strict version checking that is causing this problem. Add

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

at the very bottom of your app build.gradle file.

Solution 2 - Android

I had the same issue. I solved it by updating firebase messaging to the latest version(at this time).

implementation 'com.google.firebase:firebase-messaging:17.0.0'

to

implementation 'com.google.firebase:firebase-messaging:17.3.4'

and it is resolved(without side effect)

Solution 3 - Android

If you had this problem you might see a lot of posts saying that you can disable this check. I don't like doing that because it hides the problem.

After a while I finally understood it was saying that some library was asking for a version I didn't have. So I added this in the build/app/build.gradle and it built

implementation "com.google.firebase:firebase-iid:17.0.2"

Just use the version it says it resolves to, in your case 16.2.0.

Solution 4 - Android

For me disabling version check did not solve the problem. What I did is to exclude firebase-iid module from firebase messaging library and add it separately

implementation ("com.google.firebase:firebase-messaging:17.3.4"){
        exclude group: 'com.google.firebase', module: 'firebase-iid'
    }

implementation 'com.google.firebase:firebase-iid:17.0.3'

Solution 5 - Android

I had a similar error with 'com.google.firebase:firebase-iid using these firebase dependencies:

  1. implementation 'com.google.firebase:firebase-core:16.0.7'
  2. implementation 'com.google.firebase:firebase-messaging:17.3.4'
  3. implementation 'com.google.firebase:firebase-database:16.0.6'
  4. implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
  5. implementation 'com.google.firebase:firebase-functions:16.1.3'

after adding

  • implementation 'com.google.firebase:firebase-analytics:16.3.0'

it went away.

Solution 6 - Android

I got the same error today. I'm using react-native-firebase and react-native-push-notification. Running ./gradlew :app:dependencies I saw that react-native-push-notification was requiring the latest version of com.google.firebase:firebase-messaging, which in turn was requiring com.google.firebase:firebase-iid:[17.0.0], causing the error.

I manually specified an earlier version of firebase-messaging for react-native-push-notification as described here. That fixed the problem for me:

// in android/build.gradle

ext {
    firebaseVersion = '17.1.0' // add this line
    // ...
}

Solution 7 - Android

This solved mine. So you can try it out. Add

googleServices { disableVersionCheck = true }

to app\build.gradle

Solution 8 - Android

For me it was the build.gradle file in node_modules/@aws-amplify/pushnotification (the same applies for the build.gradle file in react-native-push-notification)

change the version numbers of firebase packages to match what you have in your own app/build.gradle file.

For me that was

compile 'com.google.firebase:firebase-messaging:17.6.0' compile 'com.google.firebase:firebase-core:16.0.8'

Solution 9 - Android

  • add the latest cordova-android platform (v8.0.0)
ionic cordova platform add android@latest
  • add my fork of this plugin
ionic cordova plugin add cordova-plugin-firebasex
  • add plugin to enable AndroidX in the project
ionic cordova plugin add cordova-plugin-androidx
  • add plugin to patch existing plugin source
ionic cordova plugin add cordova-plugin-androidx-adapter
  • build!
ionic cordova build android

It's 100% works

Solution 10 - Android

For Android Studio Users Only

I had the same issue. and this is added after apply plugin: 'com.google.gms.google-services' com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

at the very bottom of your app build.gradle file and my problem was solved

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

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Solution 11 - Android

While I was setting up FCM android client from Android Studio assistant, and it was somehow only adding some old versions of fcm in my gradle file, I copy pasted exact-latest version from the android developers website itself, Then the error went on its own. Hope this helps someone facing similar issue.

Solution 12 - Android

I think I am late here to answer this but maybe this solution will solve someone's problem.

In build.gradle updating com.google.gms:google-services:4.0.0to com.google.gms:google-services:4.3.3 solved my issue.

Solution 13 - Android

I had the same issue but I solved it by updating all my firebase dependencies to the latest ones.

// Firebase
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'

    implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
    implementation 'com.firebaseui:firebase-ui-storage:5.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.3.0-alpha01'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
    
    

Solution 14 - Android

I had a similar issue, but with the error message;

> Dependency failing: com.google.firebase:firebase-messaging:17.0.0 -> > com.google.firebase:firebase-iid@[16.0.0], but fire base-iid version > was 19.0.0.

and resolved it by using the following versions in App-level build.gradle;

// Google Firebase
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'

Solution 15 - Android

I got the same issue when integrating 'firebase-analytics'.

Original code:

implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-analytics:17.0.0'

Solved by code:

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

change the 'firebase-analytics' version the same level with 'firebase-core'

Solution 16 - Android

The version increase of firebase-messaging is essentially correct, but just in case people see this going forward, I recommend seeing Current Android Release Notes to keep all of your firebase libraries up to date.

The issue is that if you implement one library that requires other Firebase libraries to run, and you add a second with the same dependencies but on later versions, you lose compatibility.

As of present time, Google has gotten much better at not releasing breaking or incompatible versions of new libraries. Use the latest of each and you should be fine.

Solution 17 - Android

I updated my firebase messaging version and it solved my problem.

Before

implementation 'com.google.firebase:firebase-messaging:17.6.0'

updated

implementation 'com.google.firebase:firebase-messaging:20.0.1'

Solution 18 - Android

If upgrading all the com.google.firebase libraries doesn't fix the issue, try upgrading the google services plugin dependency at com.google.gms:google-services.

Solution 19 - Android

I got the same issue. Issue resolved by updating latest firebase-messaging version from https://firebase.google.com/support/release-notes/android

From

implementation 'com.google.firebase:firebase-messaging:19.0.0'

to

implementation 'com.google.firebase:firebase-messaging:19.0.1'

I do not know why build error was occurring all on a sudden. It seems weird but When I updated the firebase-messaging version, issue resolved.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLucky_girlView Question on Stackoverflow
Solution 1 - AndroidNickView Answer on Stackoverflow
Solution 2 - AndroidmasoudmjmView Answer on Stackoverflow
Solution 3 - Androidsebastianf182View Answer on Stackoverflow
Solution 4 - AndroidAna KoridzeView Answer on Stackoverflow
Solution 5 - AndroidAris BarteeView Answer on Stackoverflow
Solution 6 - AndroidJack SwiggettView Answer on Stackoverflow
Solution 7 - AndroidMr StrangeView Answer on Stackoverflow
Solution 8 - AndroidMattDameonView Answer on Stackoverflow
Solution 9 - AndroidYogesh KumarView Answer on Stackoverflow
Solution 10 - AndroidExpert SuggestionView Answer on Stackoverflow
Solution 11 - AndroidnobalGView Answer on Stackoverflow
Solution 12 - AndroidPratik SanapView Answer on Stackoverflow
Solution 13 - AndroidEngineerDannyView Answer on Stackoverflow
Solution 14 - AndroidfunctupView Answer on Stackoverflow
Solution 15 - AndroidEasonView Answer on Stackoverflow
Solution 16 - AndroidWes WinnView Answer on Stackoverflow
Solution 17 - AndroidRajeev ShettyView Answer on Stackoverflow
Solution 18 - AndroidalexfdzView Answer on Stackoverflow
Solution 19 - AndroidSaidur RahmanView Answer on Stackoverflow