简体   繁体   English

谷歌 Map API 发布 apk

[英]Google Map API on release apk

im using google api on my app with android studio.我在 android 工作室的应用程序上使用谷歌 api。 i added my SHA-1 keys to google cloud platform.我将我的 SHA-1 密钥添加到谷歌云平台。 one is for debug version and another one is for release version ( same API key with different SHA-1 keys ) my debug version is working fine but when i make a signed apk, it doesn't work.一个用于调试版本,另一个用于发布版本(相同的 API 密钥具有不同的 SHA-1 密钥)我的调试版本工作正常,但是当我制作签名的 apk 时,它不起作用。 i checked google_maps_api.xml file and it's fine ( i have it on debug and also on main folders of the app ) i added my api key to AndroidManifestes with "com.google.android.maps.v2.API_KEY" and also tied "com.google.android.geo.API_KEY" but still not working ! i checked google_maps_api.xml file and it's fine ( i have it on debug and also on main folders of the app ) i added my api key to AndroidManifestes with "com.google.android.maps.v2.API_KEY" and also tied "com .google.android.geo.API_KEY”但仍然无法正常工作!

You have to provide 2 keys in AndroidManifest.xml file for using google map and google api.您必须在 AndroidManifest.xml 文件中提供 2 个密钥才能使用 google map 和 google api。

<!--Google MAP API key-->
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="@string/google_map_key" />
<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="@string/google_map_api_key" />

These 2 keys should be generated in Get an API Key .这 2 个密钥应在Get an API Key中生成。

If you use the api keys in production mode, you have to restrict the API key before using it in production.如果您在生产模式下使用 api 密钥,则必须在生产模式下使用API 密钥之前对其进行限制

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

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