1

I'm trying to use Google Maps API on emulator but I'm struggling with it. I already set up the API key (I set the package name and SHA-1 on Google console as well) but this error happens.

Here is AndroidManifest.xml:

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

Google Maps Android API: Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above

Seems like Nexus 5 cannot be used for the Google Maps API on emulator because Emulated Performance is needed to specify to use the Google Maps API.

So I tried to use Nexus 4 instead because I can specify Emulated Performance: Graphics for the device but this error happens on the display.

This App won't run until you update Google Play Services.

I looked up this error and all the answers to this error are kind of old so I cannot understand how I can configure it correctly.

How can I fix these errors? Has anyone beeen successful in using the API on emulator recently?

0xCursor
  • 2,242
  • 4
  • 15
  • 33

2 Answers2

2

When creating Virtual device only select device which has play store else play services won't be available . The latest of all is Pixel 2 so I would suggest using it

enter image description here

Manohar
  • 22,116
  • 9
  • 108
  • 144
  • But all the devices which can use Play Store cannot specify Emulated Performnace: Graphics and the first error happens. –  Oct 03 '18 at 04:20
  • @ani for me pixel 2 worked fine and maps are being shown – Manohar Oct 03 '18 at 07:27
  • Google Maps API doesn't work for me even when I leave all settings to Android Studio. The error log says `Couldn't connect to Google API client: otb{statusCode=API_UNAVAILABLE, resolution=null, message=null}` but I'm sure API is enabled. –  Oct 03 '18 at 07:39
0

You can test the google map api. Seems like that device is missing google play service and/or might be running at a out of scope api level. The emulator I use without a problem is a Pixel XL. Try that emulator or at least make sure the new emulator shows it has google play services

Keheira
  • 90
  • 1
  • 10
  • I tried to use Pixel Xl but the same error happens. `This App won't run until you update Google Play Services.` –  Oct 03 '18 at 03:54
  • Do any of your available devices have the google play service icon? Is everything up to date? – Keheira Oct 03 '18 at 03:56
  • You mean play store icon? Some of the devices like Pixel or Nexus can use it but these devices cannot specify Emulated Performance. –  Oct 03 '18 at 04:03
  • When you go to create an emulator do you see something like the play store icons on the first image on https://developer.android.com/studio/run/managing-avds – Keheira Oct 03 '18 at 04:16
  • Yes. But the devices which have the icon cannot sepficy Emulated Performance. How can you use Google Play Service on Pixel XL? –  Oct 03 '18 at 04:19
  • Try this: https://stackoverflow.com/a/13729209/3670439. If that doesn’t work I’m not sure, and I apologize. – Keheira Oct 03 '18 at 04:29