0

I am using a lot of Firebase related libraries in my project. Upon syncing, I am facing the following error.

Android dependency 'com.google.firebase:firebase-iid' has different version for the compile (17.0.3) and runtime (17.1.1) classpath. You should manually set the same version via DependencyResolution

The thing is that I have not even declared firebase-iid in my dependencies and this is coming as a transitive dependency from other firebase libraries.

Upon running the dependency chart, I am able to find the following things.

Version 17.0.3 is coming from com.google.android.gms:play-services-measurement-api:16.4.0 Whereas 17.1.1 is coming from com.google.firebase:firebase-messaging:17.5.0

Ideally it should resolve it internally and the higher version should be automatically picked. But this is not happening.

Any idea why this is happening and how to resolve this issue?

Timo Salomäki
  • 7,099
  • 3
  • 25
  • 40
thedarkpassenger
  • 7,158
  • 3
  • 37
  • 61

2 Answers2

0

There is not updated gradle for com.google.android.gms:play-services-measurement-api: The latest release is on March 2019, version : 16.4.0 .

So, your implementation is not correct for this measurement-api .

Use :

com.google.android.gms:play-services-measurement-api:16.4.0

com.google.firebase:firebase-messaging:17.5.0

refer this link : https://mvnrepository.com/artifact/com.google.android.gms/play-services-measurement-api/16.4.0

https://mvnrepository.com/artifact/com.google.firebase/firebase-messaging

Hitesh Sarsava
  • 666
  • 4
  • 15
0

Yes you are right, gradle should automatically resolve to a single version of a library, but as I experienced sometimes, it does, sometimes, it does not. But when It does not resolve to a single version of same library, we can force it to use a single specific version like explained below.

configurations.all { 
  resolutionStrategy {
     force "com.google.android.gms:play-services-measurement-api:17.1.1"
     force "com.google.firebase:firebase-messaging:17.5.0"
  }
 }
  dependencies {
  // ... all dependencies here...
  }

Try using above code forcing gradle to use a single version. Might help in your case.

akashzincle
  • 1,108
  • 6
  • 15