In project 'app' a resolved Google Play services library dependency depends on another at an exact version

后端 未结 22 1857
情话喂你
情话喂你 2020-12-08 13:42

Trying to create a simple app with FireStore and Google Authentication. Having problem with the gradle:

In project \'app\' a resolved Google Play serv

相关标签:
22条回答
  • 2020-12-08 14:05

    I am using One Signal and caught this error once a time.

    The reason was:

    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    apply plugin: 'com.android.application'
    

    to put apply plugin for one signal before 'com.android.application'. Maybe this will be useful for some other apply plugin too.

    0 讨论(0)
  • 2020-12-08 14:05
    This worked for me!
    
    dependencies {
        classpath "com.android.tools.build:gradle:3.4.2"
        classpath "com.google.gms:google-services:4.3.3" // Need the latest here
    }
    
    dependencies {
        ...
        // add the Firebase SDK for Google Analytics
        implementation 'com.google.firebase:firebase-messaging:20.1.0'
        implementation 'com.google.firebase:firebase-analytics:17.2.2'
        ...
    }
    
    0 讨论(0)
  • 2020-12-08 14:07

    Thanks, but unfortunately, this didn't entirely work for me. I also had to add the following to my build.grade (Module:app)

    implementation 'com.google.android.gms:play-services-flags:16.0.1'
    implementation 'com.google.android.gms:play-services-basement:16.0.1'
    
    0 讨论(0)
  • 2020-12-08 14:10

    Add the line below in you Project's build.gradle (See image below)

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

    Then update your Firebase related packages by going to :

    File > Project Structure > Dependencies > app

    Update Firebase modules to latest version (See the image below)

    In my case I am using :

    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-messaging:20.1.7'
    implementation 'com.google.firebase:firebase-core:17.4.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'
    
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    

    Don't forget to add :

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

    See my Module's build.gradle file below.

    0 讨论(0)
  • 2020-12-08 14:10

    If you used song haesuk answer, you need to do it for both build.gradle Project (classpath in dependencies), and in build.gradle app (implementations). Also do the same if you change builds for any libraries imported to the app.

    I use suggestions provided by android studio and it changed implementations but did not change dependencies hence during build, there was a conflict between the two and it gave me same error.

    0 讨论(0)
  • 2020-12-08 14:10

    I replicated the issue when I accidentally added com.google.firebase:firebase-ml-vision twice with different versions.

    0 讨论(0)
提交回复
热议问题