-4

I am planning to upload my first app on PlayStore and it uses Google Maps V2 and Facebook SDK. So far, I have used the tutorials on AndroidHive and mostly followed the steps blindly.

Google Maps and Faceboook both require me to generate a keyhash and a keycert. I generated my key cert as:

keytool -exportcert -alias androiddebugkey -keystore "%USERPROFILE%\.android\debug.keystore" | openssl sha1 -binary | openssl base64 > Desktop/SSL.txt  

Now, to release an app I will create a new keystore using Eclipse's EXPORT wizard.

After creating a new keystore, will I have to generate new keys for Google Maps and Facebook by pointing to the newly generated keystore?

Tutorial for Facebook SDK: http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/
Tutorial for Google Map V2: http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/

An SO User
  • 24,612
  • 35
  • 133
  • 221
  • Facebook keyhash will not change, You need to change your marked answer so others may get help. – Jitender Dev Jul 18 '14 at 11:02
  • @David How? The hash will change when I change from debug.keystore to release.keystore, yeah? :) – An SO User Jul 18 '14 at 11:03
  • Updated answer, try the code written over there and it will be proven. Facebook keyhash will not change as your package will be same. – Jitender Dev Jul 18 '14 at 11:05
  • Try this code using same signed keystore and with different machine and you will notice the difference. The Facevbook keyhash will change. – Jitender Dev Jul 20 '14 at 09:43
  • @David what I said you that if change if you do process with debug.keystore. if you do test on different machine using release.keystore which you created from eclipse export wizard or keytool then I am sure it will remain same on all PC. HashKey depends on the SHA1 that is associated with keystore file so release keystore has same signature always so hashkey also remain same in release.keystore – N Sharma Jul 20 '14 at 16:03
  • @LittleChild you need to update you checked answer. – Jitender Dev Jul 20 '14 at 16:31
  • +1. This is good question not bad. – N Sharma Jul 20 '14 at 16:55

2 Answers2

2

After creating a new keystore, will I have to generate new keys for Google Maps and Facebook by pointing to the newly generated keystore?

Case 1

If you are using the debug.keystore and signing the build from debug.keystore then you will see that hashkey will change if you sign the same application from another system because debug.keystore is different for both machine. But You can't upload the app on Google Play Store after sign the build using debug.keystore so you need a own keystore.

Case 2

So When you here created a new keystore then you need to create a new hashkey for this. If you copy this keystore and paste to another system then generate a facebook hashkey then it will remain same because keystore of both system is same that is created by you.

It does not matter you are generating a hashkey from either code or keytool in second case it will remain same because you are using same your own keystore.

Hope you understand now everything from this major edit.

N Sharma
  • 33,489
  • 95
  • 256
  • 444
  • 1
    facebook hash will not change – Illegal Argument Jul 11 '14 at 10:26
  • @IllegalArgument Do you know that you can not publish the app on Google Play using debug.keystore. Have you read in the question `"%USERPROFILE%\.android\debug.keystore"` – N Sharma Jul 11 '14 at 10:30
  • so @ Little Child you would have to create a different keystore to publish the app on Google Play then of course you would have to create different keyhash and different Google Map key. – N Sharma Jul 11 '14 at 10:31
  • @Williams Exactly ! creating a new keystore will mean that I will have to regenerate a new hash and a new cert (and update them likewise on the websites) and once I have released the app, I will use the `release-keystore` and then no changes at all :) – An SO User Jul 11 '14 at 10:32
  • Yes for release certificate then you would not have to make changes after one time, only need to generate one time keyhash and key then update it there – N Sharma Jul 11 '14 at 10:33
  • @Williams Thank you so much for clarifying. And one last question, where do you store your `release-keystore` safely ? I know it needs to be kept very safe – An SO User Jul 11 '14 at 10:34
  • yes keep it with yourself like in your gmail account or dropbox. Don't copy release.keystore in your project – N Sharma Jul 11 '14 at 10:35
  • @Williams I am well aware about the question and also damn sure that facebook hash will not change because I have uploaded app using fb login. I generated facebook hash using code provided in the fb website not using open-ssl. Though I might be wrong my apps are behaving like they should. So kindly point out my mistake – Illegal Argument Jul 11 '14 at 10:38
  • @IllegalArgument I don't know you are well aware, anyway, I know your approach won't work – N Sharma Jul 11 '14 at 10:40
  • @Williams " Don't copy release.keystore in your project" okay now how will it get copied? Please tell me more :) – An SO User Jul 11 '14 at 10:41
  • Yes keep it with yourself on your dropbox and your PC/laptop, I meant don't paste that keystore file in your project directory otherwise anyone can get your information from it and can put you in trouble – N Sharma Jul 11 '14 at 10:42
  • @Williams Ah okay ! Thanks a lot for sorting me out ! I edited the title to make it more meaningful :) One line answer: **yes, regenerate after making release-keystore** Correct? – An SO User Jul 11 '14 at 10:43
  • @Williams and does using FB SDK require the FB native app to be installed on the user's phone ? – An SO User Jul 11 '14 at 10:54
  • 1
    Simple Answer : No, I am glad to help you :) – N Sharma Jul 11 '14 at 10:54
  • Note that the OP isn't using the debug keystore. He just named it `debug.keystore`. – Code-Apprentice Jul 18 '14 at 13:12
  • @Code-Apprentice OP is using debug keystore at the time when he posted the question. Do you agree that hashkey we need different for debug keystore and release keystore ? Afaik we need different hashkey which I wrote in the answer – N Sharma Jul 18 '14 at 17:21
  • 1
    @Williams I believe you are right. However, the OP has bigger issues since he's not really using the debug keystore. – Code-Apprentice Jul 18 '14 at 17:28
  • @Code-Apprentice thanks :) but I am 99% sure that he is using debug keystore. see this path is by default debug keystore `keystore "%USERPROFILE%\.android\debug.keystore"` – N Sharma Jul 18 '14 at 17:31
  • Nevermind. I thought he was generating a key with `keytool`. My bad. – Code-Apprentice Jul 18 '14 at 17:39
  • Yes but thanks you are agreed that we need different hashkey for debug and release keystore that I am telling to @LittleChild – N Sharma Jul 18 '14 at 17:53
  • @LittleChild I updated answer. Now I hope this will help you sure – N Sharma Jul 19 '14 at 18:43
0

The keystore for facebook will be the same as your debug release. As for the Google Maps you need to provide the release-keystore. At the last page of your export widget will present you with new Sha1-hash and md5 after signing successfully.

Jitender Dev
  • 6,907
  • 2
  • 24
  • 35
Illegal Argument
  • 10,090
  • 2
  • 44
  • 61
  • Okay, figured a little bit. Now after release, too, I will be coding and adding new features. Every time I decide to upload a newer version, I will have to change the Google Maps key from the developer console because the SHA1 has changed? :) – An SO User Jul 11 '14 at 10:29
  • @LittleChild well if your development machine is not changing then the sha1 will not change. So you dont need to worry about sha1. I have a similar app in playstore and I havenot changed anything from version 1.1 to 1.4 https://play.google.com/store/apps/details?id=com.proshore.rwd – Illegal Argument Jul 11 '14 at 10:31
  • 1
    @IllegalArgument This is correct, Facebook keyhash will not change just tried with both signed and unsigned apk. – Jitender Dev Jul 18 '14 at 11:01
  • @David I know it wont change. Facebook hash is just based on our package name that's why it wont change. facebook provides a snippet code that will log the key-hash. Also native facebook app will find the keyhash when we launch it via intent using our package name – Illegal Argument Jul 18 '14 at 11:06