0

I am trying to integrate Google Sign In in my Android app.

I have the followed the tutorial at:

https://firebase.google.com/docs/auth/android/google-signin?utm_source=studio

I am still not able resolve the following dependencies.

import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;

enter image description here

Please have a look at my gradle dependencies:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})


implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.esri.arcgis.android:arcgis-android:10.2.9'
implementation 'com.github.pedroSG94:AutoPermissions:1.0.3'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.android.support:multidex:1.0.0'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-identity:15.0.1'

implementation 'com.android.support:design:27.+'
testImplementation 'junit:junit:4.12'

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

enter image description here

I have done everything I can find online, but I am still unable to resolve this.

Sorry just adding the text above with image.

2 Answers2

1

Change classpath "com.google.gms:google-services:3.0.0" to

classpath "com.google.gms:google-services:4.0.0"

inside build.gradle(project)

And paste the following dependencies in place of yours in build.gradle(app)

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.esri.arcgis.android:arcgis-android:10.2.9'
    implementation 'com.github.pedroSG94:AutoPermissions:1.0.3'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.firebase:firebase-client-android:2.5.2'
    implementation 'com.android.support:multidex:1.0.0'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.android.gms:play-services-identity:15.0.1'

    implementation 'com.android.support:design:27.+'
    testImplementation 'junit:junit:4.12'

}
apply plugin: 'com.google.gms.google-services'
Anubhav Gupta
  • 2,492
  • 14
  • 27
0

according to these imports...

com.google.android.gms.auth.api.signin.GoogleSignInAccount;
com.google.android.gms.auth.api.signin.GoogleSignInOptions;
com.google.android.gms.common.api.ApiException;
com.google.android.gms.tasks.OnCompleteListener;
com.google.android.gms.tasks.Task;

you need the following dependencies:

dependencies {
    api "com.google.android.gms:play-services-base:15.0.1"
    api "com.google.android.gms:play-services-auth:16.0.0"
    api "com.google.android.gms:play-services-tasks:15.0.1"
}

those play-services-gcm had been deprecated; use Firebase FCM instead.

I'd just wonder why dependency com.android.support:appcompat-v7:27.1.1 is being underlined in red... could possibly tell, if you could add some build logs.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216