How to fix google play service error

前端 未结 9 1010
野的像风
野的像风 2020-11-30 06:48

Today after updating the play services in root folder I\'m facing the following problem . I\'m confused how to fix this.

Can anyone please help me to fix this ?

相关标签:
9条回答
  • 2020-11-30 06:48

    One of your dependency is having different version of com.google.android.gms.

    Update

    Firebase dependencies are having independent versions unlike past. If you have version conflicts then you can update your com.google.gms:google-services. and start defining independent version.

    Update com.google.gms:google-services

    Go to top (project) level build.gradle and update com.google.gms:google-services to version 4.1.0 or newer if available.

    buildscript {
        ...
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0'
            classpath 'com.google.gms:google-services:4.1.0' //< update this 
        }
    }
    

    Update Firebase dependencies to Latest Versions

    Firebase dependency versions can be individual. So check Latest Versions.

    com.google.firebase:firebase-core:16.0.3    //Analytics
    com.google.firebase:firebase-database:16.0.2    //Realtime Database
    

    Orignal Solution (Useful)

    Ways to resolve:

    1. Exclude com.google.android.gms from conflicted dependency.
    2. Update that dependency if available.
    3. Change your com.google.android.gms version as conflicted version.

    Problem

    how to see which dependency is using com.google.android.gms?

    1. Solution by command

    For Android, use this line

     gradle app:dependencies
    

    or if you have a gradle wrapper:

    ./gradlew app:dependencies
    

    where app is your project module.

    Additionally, if you want to check if something is compile vs. testCompile vs androidTestCompile dependency as well as what is pulling it in:

    ./gradlew :app:dependencyInsight --configuration compile --dependency <name>
    ./gradlew :app:dependencyInsight --configuration testCompile --dependency <name>
    ./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency <name>
    

    2 Use these plugins

    Gradle View is an Android Studio plugin that you can install and show dependency hierarchy. Methods Count is another plugin, it also shows dependency tree.

    0 讨论(0)
  • 2020-11-30 06:48

    For me i needed to update com.google.android.gms:play-services-base to version 15.0.1 instead of 15.0.0.

    implementation "com.google.android.gms:play-services-base:15.0.1"

    0 讨论(0)
  • 2020-11-30 06:48

    Need to use core library component together with other firebase components:

    implementation 'com.google.firebase:firebase-core:16.0.0'
    
    0 讨论(0)
  • 2020-11-30 06:54

    Try this is working for me.

    Add this in your build.gradle end of file

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

    With google play service. Version 4.3.0

    googleServices.disableVersionCheck = true
    
    0 讨论(0)
  • 2020-11-30 07:01

    Firebase components can now have independent versions (see latest release notes: https://firebase.google.com/support/release-notes/android)

    What is likely happening is one of your other dependencies is pulling in multiple versions of your com.google.firebase:* dependencies beyond your explicit dependencies onto

    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    

    You may be able to solve this specific problem by moving your dependency of firebase-messaging to 15.0.2.

    0 讨论(0)
  • 2020-11-30 07:02

    Solve the issue by following updates in android project.properties

    cordova.system.library.3=com.google.firebase:firebase-core:16.0.0
    cordova.system.library.10=com.google.firebase:firebase-messaging:17.0.+
    

    and in android cordova support google service -build.gradle

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'
    }
    
    ext.postBuildExtras = {
      if (project.extensions.findByName('googleServices') == null) {
        // apply plugin: 'com.google.gms.google-services'
        // class must be used instead of id(string) to be able to apply plugin from non-root gradle file
        apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
        googleServices { disableVersionCheck = true }
      }
    }
    

    This may help you too.

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