After the update to Android MapBox SDK 4.1.0/4.1.1 my app crashes on Android emulator with:
E/mbgl: [Shader]: Vertex shader fill failed to compile: precision
I have verified that this issue does in fact crash Android x86 physical devices. RemixOS has the exact same crash as can be seen from catlog - if anyone wants the full log - let me know, but its mostly the same as above except that I also have the reg dump and backtrace showing that it was the mapbox SDK that originated the issue.
My guess is that the issue is because most Android x86 devices aren't supporting the ES variant of OpenGL (for embedded devices), but rather the full desktop spec. This is normally not a concern, but the #ifdef specifically tests for the ES variant and then #define's away a few types that I think need to be defined. The ES variant sets highp to a float while the non-ES code leaves it blank! This would cause the compilation problem (basically JIT via LLVM) and then the lack of code and the crash-n-burn.
Is this known problem? Can this crash affect production build on physical devices? Is there any workaround?
Answer —
I also saw the same crash on an x86 emulator in OS X with Android Studio. The same app passed on an ARM device.
As you mentioned, the emulators are Intel x86 Atom_System
images.
The Mapbox Android SDK compiled in with gradle as an AAR
file includes several shared objects for different device processors including for ARM, x86 and MIPS.
That is, when you use this
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.0@aar')
You get several libmapbox-gl.so shared objects in your Android APK
For those using the emulator:
This can be fixed by changing your emulated graphics to Software - GLES 2.0
in your AVD settings. This is not ideal, but it will work (and is still much faster than emulating an ARM device).
I suspect this is emulator specific.
I'll assume you mean Android Mapbox SDK 4.1.0/4.1.1 and not DropBox ;)
First, make sure you are always using the latest version of the SDK, 4.1.1 fixes an important bug that can potentially break your app. This sounds like an issue with the emulator possibly not having OpenGL setup properly. I'm not familiar with Linux Mint but you will need to make sure your graphics driver is installed and up to date. It will also need to be able to support OpenGL 2.0 or higher.
We don't guarantee Mapbox will be able to work on an emulator but we do strive to ensure Mapbox works on as many physical devices as possible. If an emulator must be used, we recommend either the built in Android Studio one or Genymotion.