Google地图不会在已签名的apk中显示 [英] Google Maps are not showing in signed apk

查看:125
本文介绍了Google地图不会在已签名的apk中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个常见问题,通常解决方案是生成一个单独的密钥进行发布。我已经做了好几次了,开发人员控制台中的API密钥包含两个不同的SHA1指纹:一个用于从AndroidStudio进行调试,另一个用于从我自己的密钥存储区进行发布。我已经使用相同的密钥存储在应用程序上签名,并在控制台中启用Google Maps Android API v2。但地图活动仍然显示左下角有'Google'的白色屏幕。

I know this is a common question and usually the solution is to generate a separate key for release. I've done it several times and my API key in developers console contains two different SHA1-fingerprints: one for debug from AndroidStudio and on for release from my own keystore. I have signed the app with the same keystore and enabled Google Maps Android API v2 in the console. But still the maps activity shows just the white screen with 'Google' in the left bottom corner.

是否有任何建议如何解决问题?

Are there any suggestions how to solve the problem?

推荐答案

听起来您只有在调试google_maps_api.xml中输入了API密钥。另外,听起来您正在使用相同的API密钥进行调试和发布,但您仍然需要将其输入到release文件夹下的google_maps_api.xml以及debug文件夹中的一个。

It sounds like you only have the API key entered in the debug google_maps_api.xml. Also, it sounds like you're using the same API key for debug and release, but you still need to enter it in the google_maps_api.xml under the release folder as well as the one in the debug folder.

这有点令人困惑,因为当项目在Android视图中时,您只能看到调试文件(尽管它应该有(debug)在该视图旁边的括号中)。

It's a little confusing, because when the project is in Android view, you can only see the debug file (although it should have (debug) in parenthesis next to it in that view).

为了修改发行版本,使用Project Explorer左上角的下拉菜单切换到Project view 。然后,展开 app / src / ,您将看到子文件夹 debug release 。在那里,你应该在 debug / res / values release / res / values 下面看到两个单独的google_maps_api.xml文件。 。

In order to modify the release version, switch to Project view by using the dropdown in the upper left of the Project Explorer. Then, expand app/src/, and you will see subfolders debug and release. Under there, you should see two separate google_maps_api.xml files under debug/res/values and release/res/values.

确保API密钥填充在 release / res / values 下的google_maps_api.xml文件中,文件夹,因为这是用于签名发布apk的文件夹。

Make sure that the API key is populated in the google_maps_api.xml file under the release/res/values folder, since this is the one that will be used for the signed release apk.

这篇关于Google地图不会在已签名的apk中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆