Friends who develop Android will definitely use the API of Baidu Map or Amap. They need to enter the SHA1 of the development version and the SHA1 of the release version. When I first came into contact with SHA1, I passed Baidu The tutorial provided by Maps successfully obtains SHA1 through the command window. Since the development version SHA1 is not required, the obtained SHA1 is directly copied to the input box of the release version SHA1, like this.
? At that time, I didn’t know that the SHA1 obtained in this way was actually the development version, that is, the debug version. Then enter the package name, obtain the application AK and continue to develop the function. It seems that everything is normal, but when using the official After the version signature file was signed and packaged, Baidu Maps could not obtain the positioning information, prompting an error in applying the AK. Check the AK obtained by Baidu. There is no problem. I was puzzled. I sat down and smoked a cigarette quietly, and came to freestyle. , think about it, since Baidu divides SHA1 into development version and release version, there must be a reason. After consulting the information and adding my own conjecture, SHA1 is related to the signature file. The SHA1 obtained by the same computer through the command window is the same. , because the same debug signature file is used to sign and package it during the development process. When it is officially released, we use the official signature file to package it. Because the SHA1 of different signature files is different, when the official signature file is packaged, , the Baidu application AK applied for by the development version SHA1 is still used, so the problem arises.
? Through Internet search, it is not difficult to find tutorials for obtaining SHA1 of the development version and release version. Most of them are obtained through the command window. For some entry-level developers, obtaining SHA1 through the command window is a little troublesome. Therefore, in my spare time, I wrote a small demo to obtain SHA1. First, install the debug version apk or the official version apk. On the main page, obtain the third-party application APP installed on the mobile phone. Click on the APP entry that needs to obtain SHA1 to pop up the basic information of the application. And the debug version SHA1 or the official version SHA1, the SHA1 version depends on whether the apk is packaged with the debug version signature or the official version signature, then click Share in the upper right corner to share it to your computer, perfect.
? I am a newbie, I hope you can correct me if there is any wrong explanation. If there is no problem with this method, I hope to help more Android developers. The demo is attached below
GitHub address: GetSHA1
APK address: Network disk address