谷歌地图签名APK Android [英] Google Maps Signed APK Android

查看:36
本文介绍了谷歌地图签名APK Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序可以在调试模式下与谷歌地图配合使用.我创建了我的signature.jks,然后构建了我签名的APK.我使用 che 命令行代码检索 SHA1 指纹

I've got my app that works with google maps in debug mode. I create my signature.jks and then a build my signed APK. I retrieve the SHA1 fingerprint using che command line code

keytool -list -v -keystore signature.jks  -alias myalias -storepass mypass -keypass mypass

然后我将它添加到我在 google 开发者控制台上的项目中.

and I add this in my project on the google developer console.

但是当我在手机上运行该应用程序时,它不起作用.这是正确的程序吗?

But when I run the app on the phone it does not work. It is that the right procedure?

推荐答案

您应该在 Android Manifest 中为所有构建类型(调试版本等)设置映射键.如果您使用 gradle 构建,您可以在 build.gradle 中自定义键:

You should setup map key in Android Manifest for all build types (debug release etc.). If you use gradle for building you can customize keys in build.gradle:

buildTypes {

buildTypes {

debug {
    debuggable true
    ....
    manifestPlaceholders = [ map_key:"YOUR_DEBUG_cpq5sPasdasdasdAsVIdqK7tfG9xY" ]
}

release {
    debuggable false
    ....
    manifestPlaceholders = [ map_key:"YOUR_RELEASE_4RUFCUrHhZJWpqKGs-d1hOIxELs" ]
}

在 Android 清单中:

And in Android Manifest:

<meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="${map_key}" />

这篇关于谷歌地图签名APK Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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