我收到

使用Google帐户Android版本7.1.1登录时无法登录:16“

但是,当我使用相同的Android版本(7.1.1)登录物理设备时,它很好

我检查了 google-service.json 文件, client_id for client_type :3与Web应用程序的客户端ID匹配 .

fun getGoogleSignInClient(token: String): GoogleSignInClient {
    val gso: GoogleSignInOptions = 
GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(token)
            .requestEmail()
            .build()

    return GoogleSignIn.getClient(context!!, gso)
}

当我转到 Firebase 控制台中的身份验证/用户时,我可以看到我想要登录的电子邮件地址 .

mGoogleSignInClient.signInIntent 返回 mName = Auth.GOOGLE_SIGN_IN_API and mId = 3

我100%确定我使用与我的物理设备相同的帐户,因为我可以访问相同的Gmail帐户 . 在 onActivityResult 中,在我选择要登录的帐户后,我收到 Task<GoogleSignInAccount!> ,其状态为 Status{statusCode=CANCELED, resolution=null}detailMessage = 16 中的异常代码

我在物理设备和模拟器上卸载了应用程序,并且我执行的操作完全相同,我仍然使用模拟器获得异常错误 .

更新:

看起来这与使用ionic-native和cordova插件开发时发现的问题相同,并且它也适用于Android版本7.1.1有些人声称他们在开发版本中不断得到这个错误,但是一旦他们切换到发布版本,一切都很好 .

https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/529#issuecomment-425771704

此外,根据Google common.api,代码16表示"The result was canceled either due to client disconnect or cancel"