Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook not working with Exported/Signed APK File

I have recently got Facebook to work when debugging my application by following the insructions on facebooks developer page on how to export and get the hash key we need to put in the developer portal.

So now this is done, i tried using facebook log in with a exported and signed version of my application. Unfortunately i was not able to get it to work. It would never return a log in session after logging in through the facebook app or web page.

I believe this is due to the keys being difference between the released and signed apk and the apk i use to debug.

Anyone know how to fix this problem?

like image 633
Coder_Moler10345 Avatar asked Feb 21 '13 04:02

Coder_Moler10345


1 Answers

You are correct on the key hash's being different from the debug.keystore and the release signing key. To remedy that, follow the steps on this website here: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1

It has a nice tutorial that will fix the issue in almost no time.

The gist of it is:

  1. Download OpenSSl for Windows and extract the .zip to a simple location like: c:\openssl with all the contents of the zip extracted in this folder's root.
  2. Copy your signing key file to your JRE installation's bin folder. For example, in my case: C:\Program Files\Java\jre7\bin
  3. While in the bin folder where you copied the signing key, Press SHIFT+ Right Click -> Open command window here.
  4. Run this command: keytool -exportcert -alias YOUR_ALIAS -keystore YOUR_SIGNING_KEY > c:\openssl\bin\debug.txt
  5. Enter your password for the signing key
  6. Now, navigate to the c:\openssl\bin folder and type in the following commands:

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. Copy this in your app console and you are all set.

This sounds lengthy, but you really will be done in literally 4 - 5 minutes. ;-)

like image 177
Siddharth Lele Avatar answered Oct 02 '22 17:10

Siddharth Lele