Google Maps未显示在已签名的APK中 [英] Google Maps are not showing up in a signed apk

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

问题描述

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

是否有解决问题的建议?

解决方案

听起来您只有在调试google_maps_api.xml中输入了API密钥.同样,听起来您在使用相同的API密钥进行调试和发布,但是您仍然需要在release文件夹下的google_maps_api.xml和debug文件夹中的API密钥中输入它.

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

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

请确保将API密钥填充在 release/res/values 文件夹下的google_maps_api.xml文件中,因为这是用于签名发行版APK的密钥.

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?

解决方案

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.

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).

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.

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 Maps未显示在已签名的APK中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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