Muhammad Hassan Niazi Muhammad Hassan Niazi - 3 months ago 112
Android Question

Firebase : Can't resolve google auth and GoogleSignInResult libraries

I just started with Android and I am looking in to using Google Firebase for Google Sign-In. Unfortunately I am unable to import

import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;


The error I get is

Cannot resolve symbol Auth
Cannot resolve symbol GoogleSignInResult


My Project
build.gradle
looks like

dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:3.0.0'
}


My Module
build.gradle
looks like

apply plugin: 'com.google.gms.google-services'
.......
.......
.......
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
}


Also following are the errors

Error:(229, 29) error: cannot find symbol variable disconnect_button
Error:(227, 29) error: cannot find symbol variable sign_out_button
Error:(225, 22) error: cannot find symbol variable sign_in_button
Error:(214, 5) error: method does not override or implement a method from a supertype
Error:(222, 5) error: method does not override or implement a method from a supertype
Error:(117, 45) error: package Auth does not exist
Error:(60, 25) error: cannot find symbol variable Auth
Error:(210, 30) error: cannot find symbol variable sign_out_and_disconnect
Error:(206, 13) error: cannot find symbol variable mStatusTextView
Error:(201, 55) error: cannot find symbol variable firebase_status_fmt
Error:(200, 13) error: cannot find symbol variable mStatusTextView
Error:(164, 35) error: package Auth does not exist
Error:(151, 44) error: cannot find symbol class GoogleSignInActivity
Error:(204, 30) error: cannot find symbol variable sign_out_and_disconnect
Error:(12, 39) error: package com.google.android.gms.auth.api does not exist
Error:(198, 9) error: cannot find symbol method hideProgressDialog()
Error:(174, 13) error: package Auth does not exist
Error:(15, 46) error: cannot find symbol class GoogleSignInResult
Error:(188, 13) error: package Auth does not exist
Error:(59, 108) error: incompatible types: LoginActivity cannot be converted to OnConnectionFailedListener
Error:(155, 25) error: cannot find symbol method hideProgressDialog()
Error:(200, 55) error: cannot find symbol variable google_status_fmt
Error:(206, 45) error: cannot find symbol variable signed_out
Error:(117, 13) error: cannot find symbol class GoogleSignInResult
Error:(209, 30) error: cannot find symbol variable sign_in_button
Error:(201, 13) error: cannot find symbol variable mDetailTextView
Error:(207, 13) error: cannot find symbol variable mDetailTextView
Error:(203, 30) error: cannot find symbol variable sign_in_button
Error:(136, 9) error: cannot find symbol method showProgressDialog()


Thanks.

Answer

With this two dependencies:

  compile 'com.google.firebase:firebase-auth:9.4.0'
  compile 'com.google.firebase:firebase-core:9.4.0'

You also need to add one which is below. This is the part you need to include which is Play Services Auth that's it:

compile 'com.google.android.gms:play-services-auth:9.0.2'

And move apply plugin: 'com.google.gms.google-services' below all this dependencies means at last:

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