Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps are not showing up in a signed apk

I know this is a common question and usually the solution is to generate a separate key for release. I've done it several times and my API key in developers console contains two different SHA1-fingerprints: one for debug from AndroidStudio and on for release from my own keystore. I have signed the app with the same keystore and enabled Google Maps Android API v2 in the console. But still the maps activity shows just the white screen with 'Google' in the left bottom corner.

Are there any suggestions how to solve the problem?

like image 971
mityakoval Avatar asked Sep 12 '15 23:09

mityakoval


People also ask

Does APK need to be signed?

All applications must be signed. The system will not install an application on an emulator or a device if it is not signed. To test and debug your application, the build tools sign your application with a special debug key that is created by the Android SDK build tools.

Can I integrate Google Maps in my app?

Android allows us to integrate google maps in our application. You can show any location on the map , or can show different routes on the map e.t.c. You can also customize the map according to your choices.


2 Answers

It sounds like you only have the API key entered in the debug google_maps_api.xml. Also, it sounds like you're using the same API key for debug and release, but you still need to enter it in the google_maps_api.xml under the release folder as well as the one in the debug folder.

It's a little confusing, because when the project is in Android view, you can only see the debug file (although it should have (debug) in parenthesis next to it in that view).

In order to modify the release version, switch to Project view by using the dropdown in the upper left of the Project Explorer. Then, expand app/src/, and you will see subfolders debug and release. Under there, you should see two separate google_maps_api.xml files under debug/res/values and release/res/values.

Make sure that the API key is populated in the google_maps_api.xml file under the release/res/values folder, since this is the one that will be used for the signed release apk.

enter image description here

like image 148
Daniel Nugent Avatar answered Sep 22 '22 16:09

Daniel Nugent


If you chose Google Play App Signing then your App's SHA-1 will be different one when it will be released.

Because Google remove your uploaded certificate and then sign the App with a new one,

So you have to know the new SHA-1 key.

(You don't have to follow the log for release and track the new SHA-1 generated)

enter image description here


You can compare the 2 SHA-1 keys.

Origin answer

like image 22
Wajih Avatar answered Sep 18 '22 16:09

Wajih