Android: Google Map v2 not showing map for release

2019-01-17 07:37发布

My google map app works fine on device with debug google map API KEY but when I create signed apk for my app with release google map API KEY, it does not display map. To generate release mode google API KEY , i am using SHA1 fingerprint with my keystore. And i am also defining "signing and build types" in my project Settings as explained by developer.android.com(http://developer.android.com/tools/publishing/app-signing.html).

Tried every possible solution(removing apk and than reinstalling it again, restarting the device, cleaning the project ). nothing worked. Anybody have a good solution to my problem please help. FYI Using android studios platform.

14条回答
成全新的幸福
2楼-- · 2019-01-17 08:26

I had a similar issue and the problem was that I generated the apk from Android Studio without first selecting the right flavour. This means my manifest was still using the Google Maps API key that I created for the debug flavour.

Please make sure you select the release flavour in your Android Studio. See screenshot below:

enter image description here

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-01-17 08:33

The API key needs to be hardcoded into the Android Manifest, and it doesn't work if it's in a separate resources XML file.

查看更多
登录 后发表回答