Get key hash for release

折月煮酒 提交于 2019-12-24 03:55:08

问题


I have been trying to get my key hash for my release to work for hours now, and I must be doing something wrong because I have searched and tried so many different things,

Now lets say my alias is john_doe_key, and my keysotre is located at /Users/loaner/Downloads/UEat/app/app-release.apk

I would have my command in my terminal look like this correct?

keytool -exportcert -alias john_doe_key -keystore ~/Users/loaner/Downloads/UEat/app/app-release.apk | openssl sha1 -binary | openssl base64

or is that not right?

I have tried this and logging the key like face books says in the guide.

Thanks for the help in advance


回答1:


From reading your comment and seeing what you have so far, you're trying to get the key hash for Facebook, right?

First, make sure that you have signed your apk (which is your app). You can sign your apk in Android Studio by Build -> "Generate Signed APK...". When you sign your apk, you create your keystore and an alias for that keystore. I think your are confusing "keystore" with the "apk".

Also, you have to include your alias and keystore passwords in your command.

It should look like this:

keytool -exportcert -keystore keystore_file -alias alias_name -storepass keystorepassword -keypass aliaspassword | openssl sha1 -binary | openssl base64

Also, make sure that you are creating a "Release Build", which can be selected from the Build Variants menu.




回答2:


Generate a key store

$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

Sign an apk.

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name


来源:https://stackoverflow.com/questions/27813322/get-key-hash-for-release

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!