我试图在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工作室?


当前回答

获取生产密钥库的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.

其他回答

我直接在我的Mac上使用终端使用下面的命令。我得到了SHA1手指。命令如下:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

在终端输入此命令

格拉德尔签名报告

非常重要的

新闻 Ctrl + enter

机场当局不进入

这招对我很管用:

keytool -exportcert -alias androiddebugkey -keystore

将调试或生产密钥库的路径放在这里,如C:\users\youruser.android\debug。Keystore -list -v .使用实例

确保您已经在命令或终端窗口中的Java\jdk*\bin目录中。

然后使用Android作为密码。

有时网络资源可能具有误导性。这些是有效的:

SHA1指纹教程 快速入门示例应用程序

许多用户给出了他们的答案,在Android Studio 4.2以下的版本中运行良好。但对于Android Studio 4.2和更新版本,遵循以下步骤生成SHA密钥。步骤在这些图片中给出。

步骤:

1)点击gradle。Android Studio的右上角。正如你在这张照片上看到的。

2)现在点击图标如下图所示。一个新的可搜索窗口/屏幕将打开。

3)现在输入gradle signingreport,按Enter键开始生成SHA KEY,如下图所示。

4)您的SHA密钥将生成如图所示。使用这些步骤,你可以在Android Studio 4.2中生成SHA KEY。

注意:-如果您无法获得SHA密钥,则按照本回答中给出的说明进行操作。(颤振/反应本机…)

链接:-SHA颤振/反应本机键

我刚刚找到了在Android Studio中获得SHA-1的案例:

单击您的包,并选择新建->谷歌->谷歌地图活动 Android Studio重定向到google_maps_api.xml

您将看到获取google_maps_key所需的所有内容。