[英]android facebook login stops working if app is downloaded from google play
I uploaded my fully working app on Google Play and when download it from there, facebook login doesn't work!! 我将功能齐全的应用程序上传到了Google Play,从那里下载该应用程序后,facebook登录不起作用! I properly configure my facebook app and works with eclipse environment.
我正确配置了我的facebook应用程序,并且可以在Eclipse环境中使用。 After searching, it can be done due to facebook key hashes.
搜索后,由于facebook键哈希,可以完成此操作。 However, I obtained it like:
但是,我得到的像:
How to generate Key Hash for facebook SDK In Mac 如何在Mac中为Facebook SDK生成密钥哈希
Seems that a key hash for distribution must be also obtained... but how? 似乎还必须获得用于分发的密钥哈希...但是如何? Thank you.
谢谢。
Alternative 1: 选择1:
Use this with the app signed with your release key . 将此应用程序与使用您的发布密钥签名的应用程序一起使用 。 Not the one that is deployed from Eclipse.
不是从Eclipse部署的。
Run this piece of code in the first Activity of your app: 在您的应用程序的第一个活动中运行以下代码:
try {
PackageInfo info = getPackageManager().getPackageInfo(
"YOUR_PACKAGE_NAME", PackageManager.GET_SIGNATURES);
for (Signature signature: info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.e("FACEBOOK APP SIGNATURE", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
This line: Log.e("FACEBOOK APP SIGNATURE", Base64.encodeToString(md.digest(), Base64.DEFAULT));
这行:
Log.e("FACEBOOK APP SIGNATURE", Base64.encodeToString(md.digest(), Base64.DEFAULT));
will log the Key Hash in DDMS. 将在DDMS中记录密钥哈希。
Alternative 2: 选择2:
C:\\Program Files\\Java\\jre7\\bin
C:\\Program Files\\Java\\jre7\\bin
openssl sha1 -binary debug.txt > debug_sha.txt
And then, 接着,
openssl base64 -in debug_sha.txt > debug_base64.txt
Done! 做完了! The debug_base64.txt contains your Key Hash.
debug_base64.txt包含您的密钥哈希。 Copy this in your app console and you are all set.
将其复制到您的应用程序控制台中,一切就绪。
In my experiece, both the methods have given me the correct Key Hash. 在我的经验中,这两种方法都为我提供了正确的密钥哈希。 However, in a few cases (rather random ones), the first alternative did not give the correct Key Hash while the second alternative has always worked .
但是,在少数情况下(而不是随机情况),第一种选择没有提供正确的密钥哈希,而第二种选择一直有效 。 See which works for you.
看看哪个适合您。
While generating release Hash key, Note this 在生成发布哈希密钥时,请注意此
When generating the hash key for production you need to use openssl-0.9.8e_X64.zip
on windows, you cannot use openssl-0.9.8k_X64.zip
在生成用于生产的哈希密钥时,需要在Windows上使用
openssl-0.9.8e_X64.zip
,而不能使用openssl-0.9.8k_X64.zip
The versions produce different hash keys, for some reason 9.8k does not work correctly... 9.8e does. 这些版本会产生不同的哈希键,由于某些原因9.8k无法正常工作,而9.8e则可以。
OR 要么
Use this below flow 在下面的流程中使用
This is how I solved this problem Download your APK to your PC in java jdk\\bin folder in my case C:\\Program Files\\Java\\jdk1.7.0_121\\bin
go to java jdk\\bin
folder and run cmd then copy the following command in your cmd 这就是我解决此问题的方法,在我的情况下,将APK下载到PC的java jdk \\ bin文件夹中的
C:\\Program Files\\Java\\jdk1.7.0_121\\bin
转到java jdk\\bin
文件夹并运行cmd,然后复制以下内容在您的cmd中命令
keytool -list -printcert -jarfile yourapkname.apk
Copy the SHA1 value to your clip board like this CD:A1:EA:A3:5C:5C:68:FB:FA:0A:6B:E5:5A:72:64:DD:26:8D:44:84
and open Hex To Base 64 to convert your SHA1 value to base64. 将SHA1值像以下
CD:A1:EA:A3:5C:5C:68:FB:FA:0A:6B:E5:5A:72:64:DD:26:8D:44:84
这样复制到剪贴板上打开“ 十六进制到基数64”将SHA1值转换为base64。
Try this solution, for me I was getting the same error, but working fine now after trying hours. 尝试此解决方案,对我来说我遇到了同样的错误,但是尝试几个小时后现在可以正常工作。
Login Error: There is an error in logging you into this application. 登录错误:将您登录到此应用程序时出错。 Please try again later
请稍后再试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.