简体   繁体   English

当我将构建发布 apk 时,React 本机 Google 登录失败

[英]React native Google Signin Fail When i will build release apk

我将使用谷歌登录它正在工作,但每当我创建发布时,它都无法正常工作

GoogleErrorcode : DEVELOPERERROR

Please check if Google Play App Signing is enabled from the Google Play Console -> Release Management -> App Signing.请从 Google Play Console -> Release Management -> App Signing 检查是否启用了 Google Play App Signing。
Please try below steps:请尝试以下步骤:

1] You have to copy the SHA1 from the 'App signing certificate' section and need to add it to the Firebase projects general settings section.
2] Afterward need to regenerate the json file and add it to the project.
3] Re-generate the apk and the error will get resolved.

If folks are still having this issue and have stumbled across this as i did.如果人们仍然遇到这个问题并且像我一样偶然发现了这个问题。 Here's what i figured out for my react native android firebase project这是我为我的react native android firebase 项目想出的东西

THERE ARE MULTIPLE SHA-1's TO ADD IN FIREBASE有多个 SHA-1 要添加到 FIREBASE 中

1. SHA-1 For Release Variant 1. SHA-1 用于发布变体

This is found in the Keystore file.这可以在密钥库文件中找到。 You would have to add it to your Firebase Console Project Settings您必须将其添加到Firebase 控制台项目设置中

a.一种。 Get release variant SHA-1 by running command below from you RN project root通过从您的 RN 项目根目录运行以下命令来获取发布变体 SHA-1

$ cd android && ./gradlew signingReport

b.Add the release SHA-1 from here to your Firebase Console Project Settings将此处的 SHA-1 版本添加到您的Firebase 控制台项目设置


2.SHA-1 After you upload to google play store for testing / prod rollout 2.SHA-1 在您上传到 google Play 商店进行测试/产品发布后

a .SHA-1 is found in the left nav of your google playstore console. .SHA-1 位于您的 google Playstore 控制台的左侧导航中。 Setup -> App signing -> App signing key certificate设置 -> 应用签名 -> 应用签名密钥证书

b.Add this to your Firebase Console Project Settings for google sign in to work in testing / prod将此添加到您的Firebase 控制台项目设置中,以便 google 登录以进行测试/生产

Solved by adding release keystore SHA-1 to firebase console.通过将发布密钥库 SHA-1 添加到 firebase 控制台来解决。

Use below command to create release SHA-1 and Add it to firebase console:使用以下命令创建发布 SHA-1 并将其添加到 firebase 控制台:

keytool -list -v -keystore {keystore_name} -alias {alias_name}

Note : Apk not need to create again.注意:Apk 不需要重新创建。

Yesterday same problem occurred to me.昨天我也遇到了同样的问题。

Google has released a new signing service in playstore publish console in which google will signin your app with his keystore.谷歌在 Playstore 发布控制台中发布了一项新的签名服务,谷歌将在其中使用他的密钥库登录您的应用程序。 After signing , it will give you a new SHA which you have to add in your firebase account.签名后,它将为您提供一个新的 SHA,您必须将其添加到您的 Firebase 帐户中。

see the image for the better understanding查看图片以便更好地理解

enter image description here在此处输入图片说明

I have got a solution to this problem.我有一个解决这个问题的方法。 You have to put both SHA key ie SHA for debug Keystore file and SHA for release jks file, into the firebase project setting.您必须将 SHA 密钥,即用于调试密钥库文件的 SHA 和用于发布 jks 文件的 SHA 放入 firebase 项目设置中。

  • Go to: https://console.firebase.google.com/转到: https : //console.firebase.google.com/
  • Now choose your project现在选择你的项目
  • Click the setting button near Project Overview单击项目概述附近的设置按钮
  • Choose Project Setting选择项目设置
  • Enter both SHA1 (debug SHA1 and release SHA1) in SHA certificate fingerprint在 SHA 证书指纹中同时输入 SHA1(调试 SHA1 和发布 SHA1)
  • Save it保存
  • Download the google-services.json file下载 google-services.json 文件
  • Run npx react-native run-android --variant=release in terminal在终端中运行 npx react-native run-android --variant=release

It worked for me very well.它对我非常有效。

After than many time trying i got the solution.经过多次尝试,我得到了解决方案。

In GoogleSignin.configure i was place android client it, that why i getting the error在 GoogleSignin.configure 我放置了 android 客户端,这就是为什么我收到错误

Finally i will place the web client id( Here )最后,我将放置 Web 客户端 ID(此处

GoogleSignin.configure({
  iosClientId: 'client ID',
  webClientId: 'My Web client ID'
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM