Firebase GoogleSignIn无法通过Play商店提供发布版本

时间:2018-05-22 18:23:40

标签: android firebase firebase-authentication google-signin googlesigninapi

我使用Firebase SDK在我的Android应用中集成了Google SignIn。 下面是我的代码,用于检查身份验证是否成功。当我通过Play商店分发发布APK时,身份验证失败,错误代码为10.使用adb install或Crahlytics Beta安装或只需单击" apk"就可以正常发布APK了。设备上的文件。

override fun onActivityResult(requestCode: Int , resultCode: Int, data: Intent) {

     super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        var task: Task<GoogleSignInAccount> = GoogleSignIn.getSignedInAccountFromIntent(data);
        try {
            // Google Sign In was successful, authenticate with Firebase
            var account: GoogleSignInAccount = task.getResult(ApiException::class.java)
            firebaseAuthWithGoogle(account);
        } catch (e: ApiException) {
            abslytics!!.logException("google_signin_failed", e)
            // Google Sign In failed, update UI appropriately
            Toast.makeText(this@GoogleSignInActivity, "Google sign in failed: " + e.message, Toast.LENGTH_LONG).show()

            // [START_EXCLUDE]
            updateUI(null);
            // [END_EXCLUDE]
        }
    }
}

1 个答案:

答案 0 :(得分:2)

添加SHA-1证书指纹&amp;从Google Play控制台到您的firebase控制台的SHA-256证书指纹。要获得这两个键,请转到Google Play控制台&gt;发布管理&gt;应用签名&gt;应用签名证书。