我刚创建了一个应用程序,使用facebook sdk 3.0来获取用户信息。这是代码:
private void getMe()
{
Session session = Session.getActiveSession();
CanBanNhanhAppActivity._fbtoken = session.getAccessToken();
// make request to the /me API
Request request = Request.newMeRequest(session,
new Request.GraphUserCallback() {
// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user,
Response response) {
//ShowDialog(response.getError().toString());
// TODO Auto-generated method stub
}
});
Request.executeBatchAsync(request);
}
早期,代码工作(通过apk安装也从eclipse部署)。
但是,最近,来自apk的app安装在调用Request.executeBatchAsync(request);
时崩溃了。虽然,通过eclipse构建的app仍然有效。我不知道为什么。我无法调试,因为只有apk安装的应用程序崩溃了。
这是权限:
private static final List PERMISSIONS = Arrays.asList( "read_stream","email", "user_photos");
p / s:我在developer.facebook上的App上添加了debug和release hashkey。
答案 0 :(得分:1)
这是你的Facebook密钥哈希问题。请从你的系统生成你的keyhash并将该keyhash粘贴到你的facebook应用程序然后使用appid。 使用以下步骤生成keyhash然后转到您的Facebook应用程序仪表板并编辑应用程序并将hashkey添加到应用程序
In order to generate key hash you need to follow some easy steps.
1) Download Openssl from: http://code.google.com/p/openssl-for-windows/downloads/list
2) Make a openssl folder in C drive
3) Extract Zip files into openssl folder
4) Copy the File debug.keystore from .android folder in my case (C:\Users\SYSTEM.android) and paste into JDK bin Folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin)
5) Open command prompt and give the path of JDK Bin folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin).
6) Copy the code and hit enter keytool -exportcert -alias androiddebugkey -keystore debug.keystore > c:\openssl\bin\debug.txt
7) Now you need to enter password, Password = android.
8) See in openssl Bin folder you will get a file with the name of debug.txt
9) Now either you can restart command prompt or work with existing command prompt
10) comes to C drive and give the path of openssl Bin folder
11) copy the following code and paste openssl sha1 -binary debug.txt > debug_sha.txt
12) you will get debug_sha.txt in openssl bin folder
13) Again copy following code and paste openssl base64 -in debug_sha.txt > debug_base64.txt
14) you will get debug_base64.txt in openssl bin folder
15) open debug_base64.txt file Here is your Key hash.
参考此博客
http://logcatsolutions.blogspot.in/2013/02/facebook-android-generate-key-hash.html
编辑:
实际上问题发生是因为你的apk签名过程。两个哈希键是不同的,尝试用相同的密钥哈希签署apk。当你签署apk使用现有的密钥库,它的密码很可能是android.try这个步骤可行。