facebook key hash, android keystore confusion - android

keytool -exportcert -alias mykeystore -keystore mykeystore| openssl sha1 -binary | openssl base64
hello, I am using the above command to generate my facebook key hash. It asks for my password and gives me a key hash. I put this key hash in the facebook app settings, yet it does not work for my signed android app.
When I was debugging the android app, I saw the console message saying it didn't recognize "android key hash blahblahblah" so I copied "blahblahblah" into the facebook app, and that worked - my android app was able to use the facebook stuff while in debug mode. But clearly that was only for the debug keystore. Now for the real keystore the one it generates is still wrong, so a production version of my app will not be able to use facebook api.
One thing about my keystore is that it was made in eclipse. It is one keystore with two keys in it. I have noticed that eclipse keystore acts different than command line keystore things, and that they are incompatible for signing things. Yet I have already released a version of my app so I need to make due with the keys I am already using.
Insight appreciated.

Use keytool -list to list the aliases you have. If you are not sure which one you used to sign the APK you released, try both. One should work.

I had this same problem - debug hash key worked but production key did not. I ended up installing OpenSSL from a different source than I originally installed, re-created the hash key, and it fixed the problem. This is the site where I got OpenSSL that worked: http://gnuwin32.sourceforge.net/packages/openssl.htm.

If running Cygwin on Windows, use cygpath to find the keystore:
keytool -exportcert -alias androiddebugkey -keystore $(cygpath -aw ~/.android/debug.keystore) | openssl sha1 -binary | openssl base64 Keystore-Kennwort eingeben: android
If using /cygpath/c/Users/name/... it will not work.

Related

Cannot generate proper release Key Hash (Android Facebook Sdk)

I am finishing an app that uses the Android Facebook SDK, in order to login with Facebook. My app must be configured with the proper generated key hash, that must exist on my computer and that must also be set into my Facebook developper console.
When I print the current key hash from my Android app, using the piece of code found on other similary stackoverflow posts, it logs me an old keyhash that I used by the past into my Facebook Developper console. It may be the debug keyhash.
Now I try to generate a release keyhash with the keytool command.
As I am working on a Mac :
keytool -exportcert -alias MyReleaseKey -keystore ~/.android/myreleasekey.keystore | openssl sha1 -binary | openssl base64
I tried almost everything, but this command never asks me for a password, and the file is never generated. Some people says that if it isn't asking for a password, then the entered path may be invalid.
So, I tried all paths, and all the things I could find on internet, such as deleting the ~/.android/debug.keystore which is generated by Android studio. Nothing works...
Why can't I generate my release keyhash ?
Does it have to be stored into the ~/.android/ folder ?
I know that when generating the debug keyhash, we must enter the "android" password as the keystore password. Can I enter the password I want for the release keystore ?
and the file is never generated.
Why do you expect a file to be generated? That command is simply supposed to output a string you then paste into the Facebook dev console.
How do you generate your release APK? Look into app/build.gradle or go to Build -> Generate Signed APK inside of Android Studio and look for the path of your keystore file (it could end with .keystore or .jks).
For now, simplify the command to generate the APK until you're certain you've found the path. Using only
keytool -exportcert -alias MyReleaseKey -keystore ~/.android/myreleasekey.keystore
won't mask any errors, and tell you exactly what's wrong.

Where do I find the android debug key build by Phonegap

I am building an App using jquerymobile and Phonegap. Phonegap should be adding the debug key for android build.
Can someone help me as to where I can find that key. I need the key to use with facebook App to connect with facebook.
All help appreciated
You can't use a debug key, but need to generate a release key and attach the keystore to build.phonegap.com build for android. Steps for getting the release key are here
http://developer.android.com/tools/publishing/app-signing.html
You need to generate new keystore. Use this command to generate it inside your terminal/CMD.
keytool -exportcert -alias YourAppName -keystore /Desktop/YourAppNameKeyStore | openssl sha1 -binary | openssl base64

Print hash key in Facebook SDK 3.0 if not using Single Sign On?

I'm having the problem "App is misconfigured" and I'm thinking the problem is the hash key.
I would to print for verify.
How can I show it in logcat without using Single Sign On but with LoginButton authentication?
Thanks.
I forgot to mention that I'm developing on Android.
perhaps you need to generate a hash key from your debug key store, and put it to your fb app config.
try to use the keytool:
keytool -exportcert -alias YOUR-ALIAS_HERE -keystore PATH_TO_YOUR_KEYSTORE -storepass KEYSTORE-PASSWORD -keypass KEY-PASSWORD | openssl sha1 -binary | openssl base64
for android debug keystore:
Alias: androiddebugkey
Both passwords: android
I finally solved!!! :D
I created a "test" project using SSO.
Linking old Facebook API it all works fine (using hash key generated with keytool) but, linking the new Facebook API 3.0.2 retrieve the error message "key mismatch".
Then, I copied the key show it in error message in dashboard and it all works!

Map tile not loading only with release certifcate android?

I have checked a lot of questions around map tiles not loading on android device. I have not been able to fix the same error I have.
I am able to test on both emulator and device my mapsview in my application with the debug key. It works absolutely fine. I had generated a maps api key for my debug certificate.
I then created a maps api key for my release certificate with its MD5. I have added that to my maps view and now the application is not working.
I have added android internet permission in the correct place in manifest file.
I have correctly generated the MD5 finger print as I did for debug key.
I have only one mapview in my app so I have just changed that api key in the layout xml.
Only difference in generating key for debug and release is this: In the command options for keytool for the release certificate I was asked passsword only once which I presume is the store pass. my key pass was never asked (actually they are the same)
I generated debug keystore MD5 like this
$ keytool -list -alias androiddebugkey \
-keystore <path_to_debug_keystore>.keystore \
-storepass android -keypass android
I created the release key MD5 like this
$ keytool -list -alias myalias_name -keystore "mykeystorepath"
I have also tested the app with the android store still no luck. What am I missing? Any help is greatly appreciated, thanks guys!
use eclipse for generating the key and exporting, also don't rely on the DEBUG variable( Android: automatically choose debug/release Maps api key? ) to switch at runtime the keys because that's broken at the moment, you have to export the app, get the md5, get the key based on this new md5, switch the map key, reexport
edit:
important steps of https://developers.google.com/maps/documentation/android/mapkey
1) $ keytool -list -alias alias_name -keystore my-release-key.keystore (NOT DEBUG KEY)
2) https://developers.google.com/android/maps-api-signup
3) update code with new key
4) clean project & build (important to clean, eclipse doesn't always do it)
5) export with eclipse
Ok all, here is how silly it was. All was fine except for the fact that I placed the key in a layout file that I was not using. Probably I was out of my mind. So quickly
The maps application will work with release key even if you just export signed application. It is not necessary that the application be put in Android store for it to work. There are some misleading comments in stack overflow that state this.
The keytool will ask for password of the keystore and it will use the same to unlock the alias key too. Only if it is different it will ask again.
The maps application with release key will work with emulator too. Just rmbr to use install adb ""

android app with facebook SSO failure in release apk

I have a problem when I want to publish my android application with facebook integrated. I signed my app with eclipse, and used "keytool -exportcert -alias androidreleasekey -keystore MyReleaseKeystore.keystore | openssl sha1 -binary | openssl base64" in terminal to generate a release key, and I added in "Native Android App" configuration. If I try to log in fb via application I received dialog with nothing.
The path to keystore file is correct because keytool asked me for password.
I used the same keystore to sign apk in eclipse and to generate fb hash. Password is correct.
I copied generated hash to fb developer console.
When I tested with debugkey, all work fine. I had a problem with hash in debug mode but I could have turn on debugging in facebook sdk Util class and check in logcat the correct hash but in release apk this trick did not work (I could not see any error).
Could anyone help me?
Check your alias in "-alias androidreleasekey" is the same with the alias you generated in ReleaseKeyStore.keystore

Categories

Resources