'Google Map API is not working on release mode

I am using Google Map in my android. It was working fine. Today I implemented Google Places API, after that when I build release APK, map is not working. I don't know that it is because of Google Places API or because of something else. I cross verified SHA1 key, keystore file. I am unable to find the issue. I am using these dependencies:

implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation "com.google.android.gms:play-services-gcm:17.0.0"

On opening map, it is showing blank map.

I am facing it only on release (signed) apk, not on debug apk. Screenshot is: enter image description here



Solution 1:[1]

You should make sure that you set your release API key.

src/release/res/values/google_maps_api.xml

Since android generates two different xml files for google maps. One for debug and One for release. You probably have your API key placed on debug only.

Solution 2:[2]

did you add the google maps api key to the manifest?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Moumen Hamada
Solution 2 Nipuna Jayawardana