我的Android应用程序中的Facebook登录在发行版apk中可以正常工作,但在Play商店上发布相同的apk后无法正常工作 [英] Facebook login in my android app is working fine in release apk, but not working properly after publishing the same apk on play store

查看:118
本文介绍了我的Android应用程序中的Facebook登录在发行版apk中可以正常工作,但在Play商店上发布相同的apk后无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的android应用程序中,我使用了facebook登录.这是我第一次使用它.

In my android application, I used facebook login. It is first time ever I used it.

登录功能在发行版apk文件中正常工作.另外,我已经通过使用keytool,openssl生成了密钥哈希:-

The login functionality is working fine in release apk file. Also, I have generated key hash by using keytool, openssl:-

keytool -exportcert -alias "MyAppAlias" -keystore "Path to keystore" | 
openssl sha1 -binary | openssl base64

我在Facebook开发者帐户的应用程序设置"中添加了生成的密钥哈希.现在,当我生成Signed apk时,Facebook登录正常,但在Play商店上发布了相同的apk后,Facebook登录却无法正常工作,它只是从调用它的位置(我的应用程序的登录活动)重定向到活动,而没有崩溃或没有回应的消息.

I added the generated key hash in App settings on my Facebook developer account. Now when I am generating Signed apk, Facebook login is working fine, but after publishing the same apk on Play Store, Facebook login is not working, it's simply redirecting to activity from where it was called(My App's login activity) without any crashes or not responding message.

谢谢.

推荐答案

最后,我解决了这个问题.

Finally, I resolved the issue.

此问题的原因 在发布要播放的应用程序商店时,我从Google Play进行了APP SIGNING,因此在那里创建了新的SHA-1密钥.

Reason Behind this issue While publishing an App to play store, I did APP SIGNING from Google Play, hence new SHA-1 key was created there.

要查看此密钥,请转到Google Play控制台,选择您的应用,然后选择发布管理->应用签名

To see this key, go to Google Play Console, select your app, then Release Management -> App Signing

在此页面上,我在应用程序签名证书"部分下获得了新的SHA-1密钥 "

On this page, I got new SHA-1 key under section "App signing certificate "

因此,关键是Google Play签名会创建一个新证书,如上图所示.

So, the point is Google Play Signing creates a new certificate as shown in above image.

在Facebook开发人员帐户中,我们需要添加由密钥库生成的密钥哈希.但是在这种情况下,我们还需要添加与该APP SIGNING证书相对应的Key哈希.现在的问题是,如何获取此证书/SHA-1指纹的密钥哈希?

In Facebook developer account, we need to add Key hashes generated by our keystore. But in this case, we also need to add Key hash corresponds to this APP SIGNING certificate. Now the question is, how to get key hash for this certificate/SHA-1 fingerprint?

如何从Google Play APP SIGNING的SHA-1密钥创建密钥哈希?

要从SHA-1密钥生成密钥哈希,请执行一个小型Java程序,

To generate key hash from SHA-1 key, execute a small Java program,

// GOOGLE PLAY APP SIGNING SHA-1 KEY:- 65:5D:66:A1:C9:31:85:AB:92:C6:A2:60:87:5B:1A:DA:45:6E:97:EA
            byte[] sha1 = {
                    0x65, 0x5D, 0x66, (byte)0xA1, (byte)0xC9, 0x31, 0x85, (byte)0xAB, (byte)0x92, (byte)0xC6, (byte)0xA2, 0x60, 0x87, 0x5B, 0x1A, (byte)0xDA, 0x45, 0x6E, (byte)0x97, (byte)0xEA
            };
            System.out.println("keyhashGooglePlaySignIn:"+ Base64.encodeToString(sha1, Base64.NO_WRAP));

输出:-

keyhashGooglePlaySignIn: ZV1dkSgxvc2p4aCtFx9tcaQr8N4=

复制此密钥哈希并将其粘贴到您的应用程序的Facebook Developer帐户设置中.这就是我的问题得到解决的方式.

Copy this key hash and paste it to Facebook Developer account settings for your app. This is how my problem got solved.

感谢所有开发人员的评论. :)

Thanks all developers for comments. :)

这篇关于我的Android应用程序中的Facebook登录在发行版apk中可以正常工作,但在Play商店上发布相同的apk后无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆