我在我的应用程序中使用Google登录方法,我今天更新了我的依赖项:
implementation "com.google.firebase:firebase-core:17.1.0"
implementation "com.google.firebase:firebase-auth:19.0.0"我盯着想要得到关于不推荐的课程的警告。
警告:(26,12)不推荐'com.google.android.gms.common.api.GoogleApiClient‘
和
警告:(27,36)不推荐'com.google.android.gms.common.api.GoogleApiClient.Builder‘
这是我的密码:
static GoogleApiClient provideGoogleApiClient(Application app) { //deprecated
return new GoogleApiClient.Builder(app) //deprecated
.addApi(Auth.GOOGLE_SIGN_IN_API).build();
}我的应用程序仍然在工作,但我如何摆脱这些警告而不需要降级版本呢?
发布于 2019-08-20 14:32:37
是的,GoogleApiClient已经被否决了。
根据文档
当您想调用Google Play服务库(例如Google登录和驱动器)中提供的Google API时,您需要创建一个API客户端对象的实例,这些对象是GoogleApi的子类。
特别是对于身份验证api,现在需要使用GoogleSignInClient。
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
// Build a GoogleSignInClient with the options specified by gso.
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);有关更多细节,请参考下列文档:
https://stackoverflow.com/questions/57575770
复制相似问题