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.
Related
my problem is that fb login works properly when my app is installed on my phone by debbuging in eclipse.When I try to install it by exported .apk file, I get the message: "app would like to get access to your public profile and list of friends" if i click ok nothing happens.
I create here the question and in comment I read the suggestion that I should generate another hash key for my .apk file.
Firstly I go to eclipse-> right click on my project -> android tools -> Export signed application package
Secondly I found the answer here, how to get the hash key for signed facebook apk.
My keystore which I create during the exporting project to file is there:
C:\Users\Group\Desktop\albert\ and is named by keystore, so I write this lines in command prompt
C:\Program Files (x86)\Java\jdk1.7.0_51\bin>keytool -exportcert -alias keystore
-keystore "C:\Users\Group\Desktop\albert\keystore" | "C:\OpenSSL\bin\openssl"
sha1 -binary | "C:\OpenSSL\bin\openssl" base64
I was asked for password and typed this one which I used for creating keystore. Then I get the hashcode, but after putting it into facebook developer panel, the login still doesn't work.
How to solve this login problem? This issue make me sick :/
Mistake was in alias, when you create new keystore file during exporting your app, you need to give a alias this which I mark. This same name you need to put to your command prompt.
so not as I done, cause I put my file name "keystore" but put there your alias name and everything will be alright
an apology, actually I speak Spanish, and my English is very basic, I'm using Google translator, I hope you understand me.
I have an application that connects to the Facebook sdk, I've created my key hash using the example of Facebook, also I created a hash key using my keystore signed by the apk, and also I have that gives you using the Log.
The problem is when I run the application with the device connected to my pc, it gives me login to facebook without problems, but when I export the. Apk to test it on another device does not open the connection to facebook, just do not start session, I hope you can help me.
You Have to generate release key for facebook and add it on Facebook App developer console for that apps
Follow Below Steps:
Download openssl-for-windows from here
Now Open command propmpt(admin recommanded) provide jdk path .
C:\Windows\system32>cd "C:\Program Files\Java\jdk1.8.0_20\bin"
Use below command for generating key hash. You need path to release keystore and openssl bin.
keytool -exportcert -alias "enter alias name" -keystore "D:\mysapp.keystore" | "E:\Projects\facebook-android-sdk-3.6\openssl-0.9.8k_X64\bin\openssl" sha1 -binary | "E:\Projects\facebook-android-sdk-3.6\openssl-0.9.8k_X64\bin\openssl" base64
Enter release keystore password.
Enter Generated key in facebook app console.
Try this way for generating your key. If it is not work , try to generate your Facebook key by using your release key not your debug key. Hope this helps.
I have a problem when I want to publish my application android with fb 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.
I tested l'app, and I got error when I wanted to login: " is misconfigured for facebook login.... "
When I tested with debugkey, all works well.
And When I generate the release key for FB, the keytool didn't ask me for the password. I think it should have?
is the "-alias androidreleasekey" should have a nother alias name? or juste whatever i like?
Any ideas? Thanks!
I've checked all the steps, everything is correct.
My problème appears just when app facebook is installed; when app facebook is not installed, everything works well.
I finished it by forcing all login FB by the browser, never by facebook app.
Thanks every one!
You must have given a wrong path to your keystore file, make sure your path is valid
as stated here : General Rule: If the tool does not ask for password, your keystore path is incorrect.
about the alias i'm pretty sure you should write the same one as you signed your app with .. because i've seen a different key is generated with different alias.
Follow these points and it's guaranteed to work:
Make sure the path to your keystore file is correct. The keytool command will generate a key even if the path is incorrect. How do you know it's correct? You are asked for a password.
The alias is critical. If you're not sure what the Alias is, export your apk once from within Eclipse (Right click project -> Android Tools -> Export signed application package). After you insert the password, you need to select an alias from the dropdown. Make sure this is exactly the same alias you should be using from the command line.
Copy the generated hash including the '=' sign at the end. and paste it to the facebook app console. Don't forget to click 'Save changes'.
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
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.