Android Emulator not showing Google Maps on Screen

旧时模样 提交于 2019-11-29 07:55:38
Mihail Mihov

I had similar problem and spent a lot of time before solve it. Usually all was OK on real device, but fails to show Google Map on some of my emulator variants. Obviously, the program code was OK, so the question was why?

What I have observed so far:

  1. If hardware acceleration is disabled - all is back working.

  2. If use pure android image, cpu-arm (not accelerated x86, it was slower), but also works.

  3. If you are under x86_64 OS - macOS 10.13.2 in my case, USE x86_64 version of emulator image, instead of universal x86!!! That was my major mistake to do not get it works! Replacing my emulator's image with x86_64 variants, solve all of them!

  • Go to AVD
  • Choose your device
  • Go into settings
  • Emulated Performance -> Graphics - set to Hardware - GLES 2.0

I also had the same issue for the same target-version and i resolve this issue by changing the google-api key.Regenerate the google api-key using the link

https://developers.google.com/maps/documentation/android-api/signup#release-cert

and add it in AndroidManifest.xml File as you added

grey87

If you use emulator of real device (like Genymotion), please make sure you have installed Google Play support.

Check Internet (GPS/Wifi/Data) is enabled on your device.

And don't forget add width and height to styles of map.

const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    justifyContent: 'flex-end',
    alignItems: 'center',
  },
  map: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    width:200,
    height:200
  }
});

For the blank screen using the maps there are usually 2 main reasons:

  • When you are using the wrong Google Api Key. (If you import the web api key it shall work, try it). and make sure you enabled the maps service.
  • Android Emulator mainly is too poor working with maps and google services. I never had my emulator running maps. So try an actual device.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!