Android Studio - Google map still blank on real Android device on release apk

Solution 1:

Make sure you enter your release API key in the google_maps_api.xml under the release folder.

First, 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 release API key is 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

Solution 2:

i was tired of trying over and over again, it turns out that PlayStore has something called App signing certificate, and the map works after i copy that sha1 and paste it in the google console for the android map.

Solution 3:

Go to https://play.google.com/apps/publish/ and then to App signing:

enter image description here

Maybe you will see this:

enter image description here

If that is the case, maybe you are a developer and not the account owner. You will have to contact the account owner and ask him/her to complete that process. Follow this article about how to do that:

https://learnfreecoding.com/how-to-sign-your-android-app-with-signed-key-private_key-pepk/

The account owner will get to this screen:

enter image description here

Ask them to choose Upload a key exported from Android Studio. They will have to upload a private_key.pepk file. This is how you get that file from Android Studio:

  • Go to Build > Generate Signed Bundle / APK....

enter image description here

Select Android App Bundle and click Next:

enter image description here

Provide the corresponding credentials and make sure to put the check on for Export encrypted key for enrolling published apps in Google Play App Signing.

enter image description here

Specify the destination folder and make sure you select release before you click Finish:

enter image description here

That will generate the private_key.pepk file that you need to provide to Upload a key exported from Android Studio.

After doing the above, when you to to the App signing section of your app, you will see something like this:

enter image description here

Then you will see the Google Maps working correctly on real Android Studio physical devices and not only on the Android Studio Emulator. This was the solution for me.

Solution 4:

When you try to create map api key please make sure the url contain correct package name. It should not take any sub package like this.

wrong package :com.gpslocation.trackerpro.Activities


correct package :com.gpslocation.trackerpro

enter image description here

After editing don't forget to save

Solution 5:

generally you must do below steps:

1- Create New maps Activity in android studio

2- In google_maps_api.xml open the link in line 3

3- Confirm data and get key in Firebase

4- Copy key in google_maps_api.xml debug and release

5- Get release SHA1 in gradle tab -> signing report

useful link for get sha1

useful link for sign application in debug mode to get sha1