The most detailed method in the history of Android Studio to obtain the SHA1 value of the development version and the SHA1 value of the release version

Foreword:

Today, I want to integrate the positioning of Baidu Maps into the project, and I want to write a small case to realize it, but when integrating Baidu Maps, I must first apply for a secret key, and the SHA1 value is required to apply for the secret key, so I will come today. Summarize how to get this value, I hope to help everyone.


Under normal circumstances:

1. Obtain the SHA1 of the development version:

Here I directly use the command console provided by Android Studio. After all, Android Studio is almost always used for Android development.

1. Open android studio, find Terminal and open it, or find Terminal at the bottom as shown below:


2. Enter the command C: to enter the c drive;

3. Then enter the command cd Users\Administrator where Administrator is your own user name. There is an .adnroid file under the Administrator file, enter the command cd .android, and finally find .android, as shown in the figure:


4. Enter the command keytool -list -v -keystore debug.keystore where debug.keystore is the default keystore of the studio, press Enter, then enter the key: android (system default) Enter (the keystore password is invisible )As shown below:


In this way, the SHA1 value of the development version is successfully obtained. Isn't it very simple, of course!


2. Obtain the SHA1 of the release version:

Obtaining the SHA1 of the release version is the same as steps 1, 2, and 3 of obtaining the SHA1 of the development version. The only difference is that step 4 is slightly different.

1. Same as above;

2. Same as above;

3. Ibid;

4. Enter the command keytool -list -v -keystore file directory\your own signature file such as mine: keytool -list -v -keystore E:\signature file\android.keystore, then press Enter, and then enter the key: ( I only know mine, haha) Enter (the keystore password is invisible) as shown below:



In this way, the SHA1 value of the release version is successfully obtained. Isn't it very simple, of course!


The above is executed under normal circumstances. I was pitted when I obtained SHA1. Next, I will talk about the abnormal situation:


1. First comes:

'keytool' is not an internal or external command, nor is it a runnable program or batch file. As shown in the figure:




So I referred to an article: http://blog.csdn.net/csdnhejingzhou/article/details/50643246 , which can indeed solve this problem;


2. The previous problem was solved, and then I followed his steps directly Run deybug.keystore, ie C:\Program Files\Java\jdk1.8.0_31\bin>cd keytool.exe
but another problem occurred: the directory name is invalid. As shown in the figure:



Finally, I directly copied the debug.keystore in the C:\Users\Administrator\.Android directory to the C:\Program Files\Java\jdk\bin directory, which is the same directory as debug.keystore. This will solve all the problems, I don't know if you will be like this, maybe I am unlucky, or I am foolishly detouring.


For more exciting content, please follow me: luoweichao.top



Respect the original, please indicate: From zsml2016 ( http://blog.csdn.net/qq_29269233 ) Power byzsml2016 infringement must be investigated!



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325563414&siteId=291194637