0

My project dependencies are as below:

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'com.google.gms:google-services:4.0.1'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

After modifying original dependencies, as below:

dependencies {
    implementation 'com.android.support:support-v4:27.0.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.0.1'
    implementation 'com.android.support:design:27.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.google.android.gms:play-services-wearable:15.0.1'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.firebaseui:firebase-ui:2.3.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    implementation 'com.gongwen:marqueelibrary:1.1.3'
    implementation 'devlight.io:navigationtabbar:1.2.5'
    implementation 'me.itangqi.waveloadingview:library:0.3.5'
    implementation 'com.yanzhenjie:recyclerview-swipe:1.1.4'
    implementation 'com.squareup.okhttp3:okhttp:3.2.0'
    implementation 'com.squareup.okio:okio:1.7.0'
    implementation 'com.google.firebase:firebase-ml-vision:16.0.0'
    implementation 'com.android.support:multidex:1.0.0'
}
apply plugin: 'com.android.application'

Then I added firebase ML dependencies,

com.google.firebase:firebase-ml-vision:16.0.0   

Gradle build failed, giving me the following message:

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 11.4.2.

Could anyone help me solve this problem?

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
HunterChen
  • 27
  • 9
  • as you can see from the error you need to use same versions for all firebase dependencies. and you are currently using different ones. – Umair Jun 13 '18 at 06:16

1 Answers1

2

Update the following:

compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'

to this:

implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'

Also update google play services API to the latest version

And in the top level gradle file:

change:

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

to this:

classpath 'com.google.gms:google-services:4.0.1'
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • another error happened...The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[11.0.4,11.0.4], [15.0.1,15.0.1]], but resolves to 15.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies. – HunterChen Jun 13 '18 at 07:02
  • check this https://stackoverflow.com/questions/50569501/gradle-sync-fails-play-services-measurement-base – Peter Haddad Jun 13 '18 at 07:06
  • still not solved...i don't get any idea about above references – HunterChen Jun 13 '18 at 08:17
  • did you click the link in the comments? – Peter Haddad Jun 13 '18 at 08:19
  • [link](https://stackoverflow.com/questions/50569501/gradle-sync-fails-play-services-measurement-base)...but i don't use 'com.google.android.gms:play-services-analytics'...so i really confused... – HunterChen Jun 13 '18 at 08:28
  • i have updated as : classpath 'com.google.gms:google-services:4.0.0' or classpath 'com.google.gms:google-services:4.0.1'. The problem is still exist... – HunterChen Jun 13 '18 at 08:38
  • click on this link https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project and update the google services dependencies – Peter Haddad Jun 13 '18 at 08:39
  • Did you try it? – Peter Haddad Jun 14 '18 at 05:36
  • i have modified my original post...one gradle build error as below:Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1 – HunterChen Jun 14 '18 at 08:28