Method for Android to obtain SHA1

Some Google play services (such as Google login and app invites) require us to provide SHA-1 of the signing certificate so that Google pay can create oauth2 client and API key for our application.

So how to get SHA-1?

There are many ways to get SHA-1. Here we introduce the method of using the command line. (use keytool. Note that keytool is a JDK tool, so set the JDK environment variable first)

SHA-1 is divided into two types: release version and debug version. The two acquisition methods are similar.

1. Commissioning version:

(1) Open the command line window and enter the C: \ users \ administrator \. Android directory, where there is a debug.keystore file.

(2) Enter the command keytool - List - V - keystore debug.keystore

The results are as follows:

The password is Android

Then the string behind SHA1 appears below.

2. Release:

First, sign your application, and then put your signature certificate in the specified directory. Suppose you put it in C: \ key \ googlesignin.jks. Googlesignin.jks signs the file generated for us

(1) Open the command window in C: \ key

(2) Enter keytool - V - List - keystore googlesignin.jks

The results are shown in the figure below:

The password is the password used when signing

Then the string behind SHA1 appears below.

summary

The above is the way Xiaobian introduced Android to get SHA1. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>