我试图在Android工作室,在Windows上做一个地图应用程序。如何查询SHA-1指纹证书编号?

当我使用Eclipse时,它就在Windows ->首选项-> Android ->构建下。但在Android Studio中,我找不到类似的选项。

我在文档里看到

Android Studio自动在调试模式下签署应用程序 从IDE运行或调试项目。

所以我试着设置我的Java bin路径,并运行以下命令,从这里取:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

然而,我得到了一个错误消息,说它是一个非法选项。

一步一步地,我如何在Android Studio中获得这些信息?

作为解决方案:我之前使用Eclipse生成的SHA-1指纹注册了我的应用程序。我可以使用相同的API键工作在我的项目在Android工作室?


当前回答

使用keytool使用API管理器的说明:

从AndroidManifest.xml文件中获取包名。然后使用 获取指纹的命令如下: Keytool -list -v -keystore mystore.keystore

其他回答

进入文件>项目结构 从模块中选择app或mobile 选择签名选项卡。 您可以单击+按钮添加证书。

我用的是@Hiren Patel的答案,但在android studio 2.2及以后的版本会有轻微的改变

Android Studio 4.2或新版本

转到右边的Gradle

打开它,然后点击执行Gradle任务,这个锅就打开了

然后您必须输入signingreport并按enter,这将执行命令并提供结果。

适用于旧版本的Android Studio

您可以在旧版本上执行上述所有步骤以获得结果。

获取生产密钥库的SHA1:

Build --> Generate Signed APK... Create keystore with password and follow the steps Go to your Mac/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin and drag the bin folder to the terminal after cd command to point at it so you can use the keytool tool. So, in terminal write cd (drag bin here) then press enter. Then, copy and paste this in the terminal: keytool -exportcert -alias Your_keystore_AliasName -keystore /Users/Home/Development/AndroidStudioProjects/YoutubeApp/app/YoutubeApp_keystore.jks -list -v Erase my path and go where you stored your keystore and drag your keystone and drop it after -keystore in the command line so the path will get created. Also, erase Your_keystore_AliaseName to put your alias keystone name that you used when you created it. Press Enter and enter the password :) When you enter the password, the terminal won't show that it receives keyboard entries, but it actually does, so put the password and press Enter even if you don't see the password is typed out.

在Android studio 4+(不确定版本)中,如果你点击右边栏的Gradle,它不会显示任何生成签名报告的选项。它会告诉你:

点击任务列表未构建…不构建gradle任务列表。并保存设置。

然后点击gradle同步按钮:

然后你会看到signingreport选项: