简体   繁体   English

已签名应用中的Android Map API密钥测试

[英]Android Map API Key testing in signed app

If I have the release key for Android Map API in my app which was generated using the signing certificate SHA-1 fingerprint and app package name. 如果我的应用程序中有Android Map API的发布密钥,该密钥是使用签名证书SHA-1指纹和应用程序包名称生成的。

How can the map view be tested using this key? 如何使用此键测试地图视图? We tried generating signed APK and running it on the device but the map was not showing. 我们尝试生成签名的APK并在设备上运行它,但地图未显示。 Is there any way to test this key before publishing the app on the Play Store? 在Play商店上发布应用程序之前,有什么方法可以测试此密钥?

Even if you add release key as suggested by @sudeep, you won't be able to see map in production. 即使您按照@sudeep的建议添加了发布密钥,您也将无法在生产环境中查看地图。 It is because Google has introduced a billing system for signed APK's. 这是因为Google引入了用于签名APK的计费系统。 You'll get $200 worth of free requests per month. 您每月将获得价值200美元的免费请求。 To enable billing follow this link https://console.cloud.google.com/billing and enable billing account. 要启用计费,请点击以下链接https://console.cloud.google.com/billing并启用计费帐户。 After enabling billing go to this link https://console.cloud.google.com/billing/projects . 启用结算后,请转到此链接https://console.cloud.google.com/billing/projects You'll see your projects listed; 您会看到列出的项目; click more-options (three dots) located at the far-right end of the project and click on change billing then follow steps to add billing to your project. 单击位于项目最右端的更多选项 (三个点),然后单击更改帐单,然后按照以下步骤将帐单添加到项目中。

For further reading: https://cloud.google.com/maps-platform/pricing/sheet/ 进一步阅读: https : //cloud.google.com/maps-platform/pricing/sheet/

There is a separate google_maps_api.xml for release apk. 有单独的google_maps_api.xml用于发布apk。 go to project 去项目

MyApplication -> app -> src -> release -> res -> values -> google_maps_api.xml

you will find <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY_HERE</string> 您会发现<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY_HERE</string>

replace YOUR_KEY_HERE with your release key 将您的发布密钥替换为YOUR_KEY_HERE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM