1

I'm using the following dependencies:

compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.firebaseui:firebase-ui-auth:1.1.1'
compile 'com.google.android.gms:play-services:10.0.1'

In the Gradle file an error is shown:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.0, 25.1.0, 24.0.0......

I can't update

com.google.android.gms:play-services:10.0.1

because i get the following error:

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.

When i remove the Firebase dependencies the error is gone. What causes this error and how can i get rid of it?

Hans
  • 523
  • 1
  • 5
  • 16

2 Answers2

1

The com.firebaseui:firebase-ui-auth:10.0.1 library has transitive dependencies on:

com.android.support:cardview-v7:25.1.0
com.android.support:customtabs:25.1.0

You can force use of a newer version by explicitly including it in your dependencies:

compile "com.android.support:cardview-v7:25.3.0"
compile "com.android.support:customtabs:25.3.0"

The other version listed in the warning message, 24.0.0, must be from the Play Services library. In Android Studio, you can open the Gradle window and double-click on :app > Tasks > android > androidDependencies to get a dependency report to find the conflicting libraries.

I would also strongly recommend replacing:

compile 'com.google.android.gms:play-services:10.0.1'

with the specific APIs you need. They are listed here in Table 1. Including the single play-services library pulls in ALL the APIs, needlessly increasing the size of your APK and frequently requiring Multidex.

See this related question for further discussion of this issue.

Community
  • 1
  • 1
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
0

did you add the classpath 'com.google.gms:google-services:versionĀ· to the dependencies and the apply plugin: 'com.google.gms.google-services' to the build.gradle ? and change the compile 'com.android.support:support-v4:25.3.0' by com.android.support:support-v7:25.3.0'

Oussema Aroua
  • 5,225
  • 1
  • 24
  • 44