Generate SHA-1 for Flutter app

2020-02-02 05:56发布

I'm trying to generate a SHA-1 for a Flutter app, for Android studio to support Google Sign in, but I don't know how to do that, I saw some posts that indicate to run a command, but there I need a jks file I guess, and flutter doesn't create that.

Could someone help me?

标签: dart flutter
8条回答
叼着烟拽天下
2楼-- · 2020-02-02 06:27

How get Release and Debug keys: one more the easiest way (May 2019). All actions are inside Android Studio.

  1. Select android/app/build.gradle file and on the right top corner click "Open for Editing in Android Studio"

enter image description here

  1. Open Gradle panel and double click on "SigninReport"

enter image description here

  1. That's it! If you use Firebase - add these 2 keys there. You should add both keys, otherwise, without release key, Google login will not work on the devices.

enter image description here

查看更多
甜甜的少女心
3楼-- · 2020-02-02 06:29

I partially agree with Rishab answer, but what we can do is

Navigate to Android folder inside project, there is gradlew file. so we can use this like :

gradlew signingReport 

in Mac

./gradlew signingReport

in my case i use it like :

D:\flutter\flutter_app\android>gradlew signingReport

Project Architecture is :

enter image description here

查看更多
▲ chillily
4楼-- · 2020-02-02 06:39

There are many ways you can do this, this is the easiest way I found.

Step 1: Open Project in Android Studio.

Step 2: Click on Signing report as show in the picture Step 3: Find your SHA1 key in the signing report below in your android studio.

Hope it helped you..!

查看更多
Evening l夕情丶
5楼-- · 2020-02-02 06:45

You won't find a gradle window view in flutter project, so here is a solution for that.. In command prompt navigate to bin folder of jdk and run this command

keytool -list -v -keystore "C:\Users\yourusernamehere\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

change user name in path

查看更多
你好瞎i
6楼-- · 2020-02-02 06:45

you can do the same on VSCode, open the folder that contain gradlew for linux and gradlew.bat for windows and run ./gradlew signingReport for linux and run gradlew signingReport for windows

run ./gradlew signingReport

查看更多
劳资没心,怎么记你
7楼-- · 2020-02-02 06:46

You can generate it even from terminal. Following is for the release mode:

keytool -list -v -keystore keystore_location -alias alias_name

example :

keytool -list -v -keystore /home/user/key.jks -alias alias_name
查看更多
登录 后发表回答