Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug a self signed android app? (Need it for facebook integration)

When hitting the "debug"-button in eclipse my App gets signed by a debug key form android which is stored in the file "debug.keystore".

Now I am implementing the Facebook SDK which forces me to use a signed app for the Single SignOn feature. That way I need to generate the hash of my companies keystore and store the one in our facebook developer account.

I know how to sign an app through the wizard in Eclipse (over the AndroidManifest.xml). How to debug such a signed app?

Can I change the debug key somehow and set up our companies key as debug key? Or how should I go? Right now I can get FB working only by signing and installing my app on a device. I already tried to generate a hash of the debug key with no luck...

like image 925
OneWorld Avatar asked Dec 06 '10 15:12

OneWorld


Video Answer


2 Answers

Just in case anyone wants to

change the debug key somehow and set up our companies key as debug key

as the original poster asks, you can do so using keytool as so:

STORE_PASS=<pass_of_company_store>
ALIAS=<alias_of_key_in_company_store>
ALIAS_PASS=<pass_alias>
keytool -importkeystore -v -noprompt \
    -srckeystore /path/to/company/key -destkeystore debug.keystore \
    -srcstorepass $STORE_PASS -deststorepass android \
    -srcalias $ALIAS -destalias androiddebugkey \
    -srckeypass $ALIAS_PASS -destkeypass android

You can then replace your debug (perhaps ~/.android/debug.keystore) with the new one that this generates, and eclipse will happily use it to build apks that can be fully debugged and accepted by facebook.

Note that you have to be very careful with this new debug.keystore. It cannot fall into the wrong hands or your app can easily be hijacked on the Google Play Store.

like image 70
JohnnyLambada Avatar answered Sep 19 '22 07:09

JohnnyLambada


I do not recommend setting your companies key as your debug key, but you can do that by replacing the Eclipse debug keystore file, named debug.keystore. You can find its location on your OS by reading through this.

A better solution would be to generate the hash of the debug key - follow the instructions given on the official SDK for Android page, and make sure you mention the correct keystore file, and the alias "androiddebugkey". The password is always "android".

like image 34
Abhinav Manchanda Avatar answered Sep 21 '22 07:09

Abhinav Manchanda