我刚开始使用 Android,我正在考虑使用 Google Firebase 进行 Google 登录。不幸的是我无法导入
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
我得到的错误是
Cannot resolve symbol Auth
Cannot resolve symbol GoogleSignInResult
我的项目 build.gradle
看起来像
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:3.0.0'
}
我的模块 build.gradle
看起来像
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'
}
下面还有错误
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()
谢谢。
最佳答案
有了这两个依赖:
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
您还需要在下面添加一个。这是您需要包括的部分,即 Play Services Auth 就是这样:
compile 'com.google.android.gms:play-services-auth:9.0.2'
然后将 apply plugin: 'com.google.gms.google-services'
移动到所有这些依赖项下方意味着最后:
apply plugin: 'com.google.gms.google-services'
关于android - 火力地堡 : Can't resolve google auth and GoogleSignInResult libraries,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39367804/