我试图在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.

其他回答

为Android生成SHA-1密钥的最佳解决方案是使用Android Studio。

点击最右边的Gradle:

点击刷新图标,你会看到应用程序的名称:

点击Tasks -> Report -> Signing Report:

在控制台底部找到SHA-1密钥:

点击右边窗格中的Gradle图标。 单击根项目名称。 点击任务 点击安卓 单击signingReport 在您看到运行报告的底部窗格中 点击“切换任务执行/文本模式” 你可以看到sha-1

您可以使用以下命令并使用您的系统名称更改AJAY SUNDRIYAL。这只适用于你的debug.keystore,这将为你工作。

C:\Program Files\Java\jdk1.8.0_91\bin>keytool -list -v -keystore "c:\users\AJAY SUNDRIYAL\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

如果你有Android Studio,那就非常简单了。只需使用Android Studio创建一个MapActivity,创建后进入google_maps_api.xml。在评论中会给出一个链接。如果你把它粘贴到浏览器中,它会要求你填写一些细节,然后你的API就会生成。没有必要使用keytool和所有。

屏幕截图:

执行以下步骤

gradle(在右上角)>点击你的项目名称>任务> android >双击signingReport

然后你会在4中得到SHA1和其他信息:Run(它会自动出现)。