Google-signin: com.google.android.gms:play-services-auth-base version problem

Created on 16 Aug 2018  路  9Comments  路  Source: react-native-google-signin/google-signin

Hello , First , I shecked all other isues and there is no similar one ,
and I also followed the configurations in the example app ,
I followed the documentation and the SDK packages requirements

app/Build.gradle

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-splash-screen')
     implementation(project(":react-native-google-signin")){
         exclude group: "com.google.android.gms" // very important
     }
     implementation 'com.google.android.gms:play-services-auth:15.0.1'
}

actual behavior

Build ERROR :

* What went wrong:
Failed to capture snapshot of input files for task ':react-native-google-signin:compileDebugAidl' property 'importDirs' during up-to-date check.
The library com.google.android.gms:play-services-auth-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 15.1.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

google-sign-in play-services-auth is requiring 15.0.1 version but the google service auth-base version is in 15.1.0 version , I tried to force google-sign-in play-services-auth to be 15.1.0 or the auth-base to 15.0.1 but any of my efforts found a solution

Enviroment

  • react ^16.3.1
  • react-native ^0.56.0
  • react-native-google-signin ^1.0.0-rc3

ANY SOLUTION ??

馃挜 Build Issue 馃Android

Most helpful comment

Hi everyone!
I solved all the issues just by adding ext{ googlePlayServicesVersion = "15.0.1" } to my android/build.gradle file, no need to write all those implementations with exclude and force. And another thing that i did was change "com.google.android.gms:play-services-auth:15.0.1" to 16.0.0 on my /android/app/build.gradle like @ngraef suggested. So, my files look like this:

/android/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.0.1'    //Added for Firebase SDK
    }
}

ext {
    googlePlayServicesVersion = "15.0.1" // <-- this line here tell other modules to overwrite and use this instead of default
}

allprojects {
    repositories {
        mavenLocal()
        maven {url "https://maven.google.com"} //Added for RN Google Signin
        google()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" } //This is from another library, not related to this RN Google Signin
        jcenter()
    }
}

/android/app/build.gradle

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.android.support:support-v4:27.1.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:design:27.1.0'
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-navigation')
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-image-resizer')
    implementation project(':react-native-fs')
    implementation project(':react-native-fbsdk')
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'

    implementation(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation 'com.google.android.gms:play-services-maps:10.0.1'
    implementation 'com.google.android.gms:play-services-base:10.0.1'

    implementation 'com.google.firebase:firebase-core:16.0.1'       //Added for Firebase SDK
    implementation(project(":react-native-google-signin")){     //Added for RN Google Signin
        exclude group: "com.google.android.gms" // very important
    }
    implementation 'com.google.android.gms:play-services-auth:16.0.0' // should be at least 15.0.0 to work with the most recent APIs. With 16.0.0 one issue was solved.
}

All 9 comments

I finally found where the problem lives
When I opened this issue I was that time intending to implement firebase in the future so choosed to implement dependencies that firebase require com.android.tools.build:gradle:3.1.3 and com.google.gms:google-services:4.0.1 , well react-native-google-signin did not supported these versions (higher than it's documentation require 3.1.2 and 3.2.1 )

dependencies confusion at myApp/android/build.gradle

dependencies {
        // works fine if I stick to documentation with these older gradle and gogle-services versions
        classpath 'com.android.tools.build:gradle:3.1.2' // <--- required by reactnative-google-signin
        classpath 'com.google.gms:google-services:3.2.1' // <--- required by reactnative-google-signin

         //produces BUILD ERROR 
        //classpath 'com.android.tools.build:gradle:3.1.3' <--- required by firebase
        //classpath 'com.google.gms:google-services:4.0.1' <--- required by firebase
    }

Coserning the myApp/android/app/build.gradle , I am now managing well the dependencies problems between firebase and google-signin thanks to this article

myApp/android/app/build.gradle :

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-splash-screen')

    implementation (project(':react-native-firebase')){
        exclude group: "com.google.android.gms"
    }
    implementation(project(":react-native-google-signin")){
        exclude group: "com.google.android.gms"
    }

    implementation ("com.google.firebase:firebase-core:16.0.1"){
        force = true;
    }

    implementation ("com.google.firebase:firebase-messaging:17.1.0"){
        force = true; 
    }
    implementation ("com.google.android.gms:play-services-base:15.0.1"){
        force = true; 
    }
    implementation ("com.google.android.gms:play-services-auth:15.0.1"){
        force = true; 
    }
}

BUT the problem remains ,, How do I manage the hight versions requirements of firebase if react-native-sign-in is sticking in to old versions ????

@firashamila33 I was implementing firebase with google and facebook too, and after some changes indicated for you, other thing that helped me was the dependencies
you can use the same as wanted for google-signin

This is my build.gradle from Android folder

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

and this is my build.gradle from my app Folder

dependencies {
    implementation (project(':react-native-firebase')){
        exclude group: "com.google.android.gms"
    }
    implementation project(':react-native-fbsdk')
    implementation (project(":react-native-google-signin")){
        exclude group: "com.google.android.gms" // very important
    }
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation ("com.google.android.gms:play-services-auth-base:15.0.1"){
        force = true; 
    }
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)' 
     implementation ("com.google.firebase:firebase-core:16.0.1"){
        force = true;
    }
    implementation ("com.google.android.gms:play-services-base:15.0.1"){
        force = true; 
    }
    implementation ("com.google.android.gms:play-services-auth:15.0.1"){
        force = true; 
    }
}

Using com.google.android.gms:play-services-auth:16.0.0 instead of 15.0.1 fixed it for me.

@mendesfelipe87 , thank you :smiley_cat: , but as you see in my second comment I did exactely the same way and everything is working fine ,
But the problem remains the same , firebase is requiring :

'com.android.tools.build:gradle:3.1.3' 
'com.google.gms:google-services:4.0.1'

and reactnative-google-signin is requiring :

'com.android.tools.build:gradle:3.1.2' 
'com.google.gms:google-services:3.2.1'

I know that it works if I respect the reactnative-google-signin low requirement and neglect the higher versions requirements of firebase ,,,, but I am afraid that this will cause problems in the future if I use more advenced firebase tools

@firashamila33

and reactnative-google-signin is requiring :
'com.android.tools.build:gradle:3.1.2'
'com.google.gms:google-services:3.2.1'

we do not require those specific versions, it's up to you to use what version you prefer but they should be >= than what the readme says

as for version of the other dependencies, please check the "Choose Dependency versions" part here, you can control that too

@firashamila33 so do you have found a solution to this issue?

like @ngraef said, use com.google.android.gms:play-services-auth:16.0.0 fixed the issue for me too.

Thank you @ngraef and yes @ggdegreat it worked for me using com.google.android.gms:play-services-auth:16.0.0
So to resume , react-native-signin requires at least 15.0.0 to work ,, but to avoid build issues when using Firebase along side with react-native-signin it should be 16.0.0

/android/build.gradle

buildscript {
    repositories {
        mavenCentral() 
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
       //  works fine with both react-native-signin & firebase
       classpath 'com.android.tools.build:gradle:3.1.3' 
        classpath 'com.google.gms:google-services:4.0.1'
    }
}
........

/android/app/build.gradle

.....
dependencies {
    implementation project(':react-native-exception-handler')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'

    implementation (project(':react-native-firebase')){
        exclude group: "com.google.android.gms"
    }
    implementation(project(":react-native-google-signin")){
        exclude group: "com.google.android.gms"
    }

    implementation ("com.google.firebase:firebase-core:16.0.1"){ 
         force = true;
    }

    implementation ("com.google.firebase:firebase-messaging:17.1.0"){
         force = true; 
    }
    implementation ("com.google.android.gms:play-services-base:15.0.1"){
        force = true; 
    }
    implementation ("com.google.android.gms:play-services-auth:16.0.0"){// <--change it from (15.0.0 || 15.0.1) to 16.0.0
        force = true; 
    }
}
....

Hi everyone!
I solved all the issues just by adding ext{ googlePlayServicesVersion = "15.0.1" } to my android/build.gradle file, no need to write all those implementations with exclude and force. And another thing that i did was change "com.google.android.gms:play-services-auth:15.0.1" to 16.0.0 on my /android/app/build.gradle like @ngraef suggested. So, my files look like this:

/android/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.0.1'    //Added for Firebase SDK
    }
}

ext {
    googlePlayServicesVersion = "15.0.1" // <-- this line here tell other modules to overwrite and use this instead of default
}

allprojects {
    repositories {
        mavenLocal()
        maven {url "https://maven.google.com"} //Added for RN Google Signin
        google()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" } //This is from another library, not related to this RN Google Signin
        jcenter()
    }
}

/android/app/build.gradle

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.android.support:support-v4:27.1.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:design:27.1.0'
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-navigation')
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-image-resizer')
    implementation project(':react-native-fs')
    implementation project(':react-native-fbsdk')
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'

    implementation(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation 'com.google.android.gms:play-services-maps:10.0.1'
    implementation 'com.google.android.gms:play-services-base:10.0.1'

    implementation 'com.google.firebase:firebase-core:16.0.1'       //Added for Firebase SDK
    implementation(project(":react-native-google-signin")){     //Added for RN Google Signin
        exclude group: "com.google.android.gms" // very important
    }
    implementation 'com.google.android.gms:play-services-auth:16.0.0' // should be at least 15.0.0 to work with the most recent APIs. With 16.0.0 one issue was solved.
}

Was this page helpful?
0 / 5 - 0 ratings