问题
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