Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Maps SDK for Android does not render in emulator #11266

Closed
samfader opened this issue Feb 21, 2018 · 12 comments
Closed

Maps SDK for Android does not render in emulator #11266

samfader opened this issue Feb 21, 2018 · 12 comments
Labels
Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl

Comments

@samfader
Copy link
Contributor

Platform: Android
Mapbox SDK version: 5.4.1

Steps to trigger behavior

  1. Follow the First steps with Mapbox Android SDK guide on a computer with Intel Iris 650 or 550 graphics card.

Expected behavior

Map should load in emulated Android device.

Actual behavior

android_emulator_-_pixel_2_api_26_5556

Map view loads but only renders the background layer. Attempting to interact in any way with the app produces these types of errors:

emulatorerrors

Note: we've tested this on computers with Intel Iris 6100 graphics cards and they are having no issues.

Here are some screenshots of the LogCat and the Event Log - I couldn't get any text because Android Studio keeps freezing.

mainactivity_java_-myfirstmapboxapp-___androidstudioprojects_myfirstmapboxapp
emulatorerrors

cc @langsmith @cammace

@samfader samfader added the Android Mapbox Maps SDK for Android label Feb 21, 2018
@bchowTWC
Copy link

bchowTWC commented Feb 27, 2018

Also started getting these errors after updating to Android Studio v3.0.1 (or whatever update came out ~a week ago). At least, updating from v3.0 to v3.0.1 was the thing that introduced the errors for me.

Only way I managed to "fix" it was by changing the OpenGL renderer to "SwiftShader" in the emulator extended controls:

image

While changing it introduced a perceptible lag and I can now see some tearing/jaggies/artifacts on the map when panning, it did bring my map back... which is all I wanted (until I have time to investigate the OpenGL errors).

For the sake of completeness -

Mid-2014 rMBP (11,3) with the dGPU (a GT750M) running Sierra 10.12.6
Android Studio v3.0.1 with whatever emulator is current as of 27 Feb 2018 01:17:55 GMT (sorry)
Mapbox SDK v5.3.2

Edit: no change using SDK v5.4.1 or v5.3.0

And fwiw, also using

  • services v2.2.9
  • building plugin v0.1.0
  • location layer plugin v0.3.0

Also, here's a possible solution I just came across (haven't tried for myself yet) - https://stackoverflow.com/a/48897719

@indrek-koue
Copy link

indrek-koue commented Mar 6, 2018

@samfader Why do you have the logs as a picture? Its hard to find this bug by doing a search using error log. Also the logs are missing part of it.

Full logs:

Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502
Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

@danswick
Copy link
Contributor

danswick commented Mar 6, 2018

@indrek-koue noted in the OP:

Here are some screenshots of the LogCat and the Event Log - I couldn't get any text because Android Studio keeps freezing.

@yang-owl
Copy link

yang-owl commented Mar 6, 2018

Did a test with Android Emulator 27.1.12 (Nexus_6_API_23), Mapbox SDK version 5.5.0 with similar results:

03-06 22:59:14.228 1371-1689/? W/audio_hw_generic: Hardware backing HAL too slow, could only write 0 of 661 frames
03-06 22:59:14.269 17676-17974/com.xxx.android.dev E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9adc61a0
03-06 22:59:14.279 17676-17771/com.xxx.android.dev E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9adc6240
03-06 22:59:14.293 1271-1271/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
03-06 22:59:17.102 17676-17991/com.xxx.android.dev I/EGLConfigChooser:267: In emulator: false
                                                                                
                                                                                [ 03-06 22:59:17.103 17676:17991 D/         ]
                                                                                HostConnection::get() New Host Connection established 0x986f40c0, tid 17991
03-06 22:59:17.106 17676-17676/com.xxx.android.dev W/PathParser: Points are too far apart 4.000000596046461
03-06 22:59:17.145 17676-17991/com.xxx.android.dev E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
03-06 22:59:17.145 17676-17991/com.xxx.android.dev E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
03-06 22:59:17.234 17676-17771/com.xxx.android.dev E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9adc2140
03-06 22:59:17.271 1271-1271/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
03-06 22:59:17.441 17676-17990/com.xxx.android.dev W/art: Attempt to remove non-JNI local reference, dumping thread
03-06 22:59:17.607 17676-17992/com.xxx.android.dev W/art: Attempt to remove non-JNI local reference, dumping thread
03-06 22:59:20.090 1371-1690/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 113484799 , only wrote 113220046

Note "In emulator: false".

Event log:

0:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform2fv:3303 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform2fv:3303 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform1f:3268 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniform4fv:3359 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

10:12 AM	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glUniformMatrix4fv:3400 error 0x502

@VitaliyR
Copy link

I dunno if it is related to graphic card, but on mine Intel Iris 640 the issue is reproducing the same.

@indrek-koue
Copy link

indrek-koue commented Mar 15, 2018

@tobrun whats the status of this issue? This issue is not related to GPU of the host device, its related to the version of android emulator. Currently Mapbox android SDK is not usable in the newest emulator and it crashes the Android studio (due the amount of error logs).

More details of this issue in a duplicate task of this issue: #11394

@yang-owl
Copy link

inEmulator() in EGLConfigChooser.java returns false when running on later versions of the emulators. Should be a relatively easy fix If that's the only issue.

@invised
Copy link

invised commented Mar 15, 2018

I've modified EGLConfigChooser to return true from inEmulator(), but the problem persists
Btw, Genymotion works fine

@tobrun
Copy link
Member

tobrun commented Mar 16, 2018

Full debug log:

java.lang.Error: glUniformMatrix4fv(location, 1, GL_FALSE, util::convert < float > (t).data()): Error GL_INVALID_OPERATION at / Users / Nurbot / mapbox - gl - native / src / mbgl / gl / uniform.cpp: 53
at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeRender(Native Method)
at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame(MapRenderer.java: 90)
at com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame(GLSurfaceViewMapRenderer.java: 55)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java: 1571)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java: 1270)

@invised
Copy link

invised commented Mar 19, 2018

In emulator version 27.2.1 works smoothly if renderer is ANGLE (D3D11), also works but lags a lot if SwiftShader is used.

So the solution for now is to update emulator to version 27.2.1, go Settings - Advanced and select OpenGL ES renderer - ANGLE (D3D11)

@ivovandongen
Copy link
Contributor

I took a look at this before the weekend and it turns out this got introduced inadvertently by trying to duck under the maximum vertex attribute limit in #9373. The problem seems to be that in the opengl implementation in the emulator, linking the program again leads to a duplication or shift of the uniform locations. This results in an error when trying to set data on any uniform (the mat4 version is just the first one to get hit).

This is somewhat apparent when running a gl trace on it.
screen shot 2018-03-29 at 15 42 38

I am not sure wether the behaviour is defined in this case, but in any case it is solved by re-binding the uniforms after re-linking the program.

@voxelbustersold
Copy link

Changing to Software Renderer (GLES 1.1) in Emulator device Advanced settings worked for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl
Projects
None yet
Development

No branches or pull requests