Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Google Maps is showing empty screen in my Android App?

I have Google Maps in my Android App. I added it by selecting new Google Maps Activity & pasting the key in Android Studio. It worked fine in my Android phone (Lenovo K5 Note) but when I copied the project to another computer & run in another device (Coolpad), it shows a blank screen (beige or white colored) with Google logo on bottom left.

like image 618
Sooraj Avatar asked Oct 16 '25 17:10

Sooraj


1 Answers

Fought with blank map past two days and here is the summary (which I'm sure is not a complete list of possible issues!) collected from various sources.


1. Missing or incorrect or disabled API key

Seems to be most often. I recommend to follow official documentation. If you finish all steps, issue persists and you're still unsure whether it could be the reason, clone official android samples, find the MapWithMarker sample (android-samples/tutorials/MapWithMarker) and test against it. If you run the sample and it shows the map correctly, try to exchange default API KEY for the one you own.

  • If it works, the key is not an issue.
  • If it doesn't work, the key is your issue.

In such case make sure, you enabled it in Google API Console.


2. Missing Android GMS version meta-data tag

Your AndroidManifest.xml needs to define following metadata attribute:

<meta-data android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version" />

See the answer here for more details and official documentation.


3. Missing user permissions

In older versions of Android SDK, you had to explicitly set certain user permissions to work with Google Maps API correctly, for example:

<uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

This is not the case anymore but I would recommend to visit official documentation to make sure you meet those version requirements.


4. Requirement for OpenGL ES version 2

In the past, there seemed to be requirement to specify following metadata attribute within AndroidManifest.xml

<uses-feature   
   android:glEsVersion="0x00020000"  
   android:required="true"/>

This shouldn't be required anymore per official documentation. Some additional details are available e.g. here.


5. AVD Manager device configurations

Android Studio 3.0 AVD Manager allows you to create device configurations for APIs that don't seem to be working well. At the moment, you can create configuration against API v27 which doesn't seem to be released yet if I'm not mistaken. Basic emulations worked well even there until I started work with Google Maps API. None of the device configurations set to v27 worked with Maps API resulting in blank map.

  • Try downgrading to lower SDK version.

Note: Would be happy if anyone with deeper knowledge correct my simplified and probably incorrect interpretation. Since this was my problem, I stopped evaluating deeper and simply switch to different configuration for now.

Using following setup:

Android Studio 3.0
Build #AI-171.4408382, built on October 20, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Hope this will help at least one person to save some time..

like image 118
Martin Janíček Avatar answered Oct 19 '25 07:10

Martin Janíček