Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

android - App is misconfigured for Facebook Login with Release Key Hash

I've intergrated Facebook to my App. I tested my App with Debug Key Hash was alright in emulator and my device HTC. When I tried the Release Key Hash for my signed APK , "App is misconfigured for Facebook login" error always happened in my device HTC One X.

keytool -exportcert -alias android -keystore C:android2012android.keystore | openssl sha1 -binary | openssl base64

I used the above-mentioned command to generate the Release key hash. The alias name is "android". It successfully generated the key hash after entering password. This key hash was input into the Facebook Dashboard and I tried to access in my signed APK but it failed.

Anyone can help? Stuck with this error for few days. Thanks a lot!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Why it works on the emulator or even on the device while you are testing it is because, while testing from eclipse, you use the debug.keystore and not your release key.

Follow one of the two solutions below, and you should be good to go.

Solution 1:

Try this link: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1. I found that using the Facebook method of getting a Hash Key did not always work as advertised. This link however, has a different method of getting the Hash Key and has pretty much always worked.

Solution 2:

That being said, I always found the simplest thing to do was, let the Facebook SDK tell you what your Hash Key is. This is by far more simpler and shouldn't take more than a couple of minutes.

Step 1: In your Facebook SDK, locate the Util.java class. In that, change this:

private static boolean ENABLE_LOG = false;

to:

private static boolean ENABLE_LOG = true;

Step 2: Create a new Signed APK, transfer to your device and install. If it is already installed, naturally, it will prompt.

Step 3: With your DDMS (Logcat) running and your device connected to the computer, run the application and keep looking for a key mismatch warning. That warning has the actual Hash Key. Copy that key, go to your Facebook Developer page and add the new key to the list.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...