Google Maps Signed APK Android

末鹿安然 提交于 2019-12-05 04:16:51

问题


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

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?


回答1:


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 {

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

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

And in Android Manifest:

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


来源:https://stackoverflow.com/questions/30298223/google-maps-signed-apk-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!