How to fix google play service error

前端 未结 9 1009
野的像风
野的像风 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 
    ./gradlew :app:dependencyInsight --configuration testCompile --dependency 
    ./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency 
    

    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.

提交回复
热议问题