Google 仅将灰色背景映射为 APK [英] Google maps only a grey background as APK

查看:24
本文介绍了Google 仅将灰色背景映射为 APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 android-studio 和通过 USB 连接的 Galaxy S3 android 手机在本地开发.

I develop locally with android-studio and a Galaxy S3 android phone connected via USB.

在我的本地开发环境中,当我启动要在 S3 上部署的运行配置时,一切正常 - 地图显示正常.

On my local development environment, when I fire up the run configuration to deploy on the S3, everything works fine - the map shows up just fine.

但是当我将已签名的 APK 部署到我们的服务器并通过 Internet 安装时(我正在尝试在另一部 Android 手机上将事情清楚地分开),地图图块没有加载,我看到左下角的 Google 标志和右上角的 GPS 位置图标.

But when I deploy as signed APK to our server, and install via Internet (I am trying on another android phone to keep things clearly separated), the map tiles don't load, I see the Google sign to the lower left and the GPS location icon on the upper right corner.

我看过一些相关的帖子:

I've seen a few related posts:

Android 谷歌地图应用显示灰色背景而不是地图

首先看起来有点过时,其次他使用 eclipse(我使用的是 android-studio),第三个 - 它对我不起作用.

which seems first a bit dated, second he uses eclipse (I am using android-studio), third - it didn't work for me.

Android - 已签名 APK 上的 Google 地图灰屏这家伙的问题没有得到任何有用的答案....

Android - Google Maps Grey Screen on Signed APK This guy didn't get any useful answers to his question....

推荐答案

第一步是使用 keytool 获取用于签署应用发行版的密钥的 SHA1 值命令行工具.

The first step is to get the SHA1 value for the key that you used to sign the release version of your app using the keytool command line tool.

keytool -list -v -keystore ~/Keystore/key1.jks -storepass <your_store_password> -keypass <your_key_password> 

~/Keystore/key1.jks 替换为您用于签署发布版本的密钥库的路径和名称,并将密码替换为您自己的.

Replace ~/Keystore/key1.jks with the path and name of the keystore that you used to sign your release version, and replace the passwords with your own.

当你在命令行执行这个命令时,它会列出证书指纹,包括你需要的SHA1值.

When you execute this command at the command line, it will list the Certificate Fingerprints, including the SHA1 value that you need.

下一步是将 SHA1 和包名称添加到 Google 开发者控制台.

The next step is to add the SHA1 and package name to a key in the Google Developers Console.

您可以将其添加到用于调试版本的相同密钥中,也可以创建一个新密钥.

You can either add it to the same key you used for debug builds, or you can create a new key.

要将您的发布 SHA1 和包名称添加到现有 API 密钥,请单击 添加包名称和指纹 按钮,然后添加您的 SHA1 值和包名.

To add your release SHA1 and package name to an existing API key, click the Add package name and fingerprint button, and add your SHA1 value and package name.

然后,您可以将此 API 密钥与应用的签名发布版本一起使用.

Then, you can use this API key with the signed release version of your app.

有关在使用不同的 API 密钥进行调试和发布时如何配置应用的更多信息,请参阅 这里.

For more information on how to configure your app if you use a different API key for debug and release, see here.

这篇关于Google 仅将灰色背景映射为 APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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