问题
After upgrading my Android Studio version to 2.1.3, my application crashes every time I launch it.
More precisely, it crashes when trying to load my Mapbox View (that was perfectly working before that).
I did some research, and it seems to be a known issue, but I couldn't find any workaround to pass through it...
I think it MAY be a problem with the Emulator only, but for now I couldn't try on a lot of physical devices, so I'm not sure about that. But anyway, I really need to use the emulator to debug my app.
If someone has any information about that it will be really helpful. Thank a lot!
Here is the error logs I receive. The first one:
09-16 13:27:59.063 2938-2938/flow.bricks D/mbgl: {flow.bricks}[Android]: NativeMapView::notifyMapChange()
09-16 13:27:59.065 2938-2938/flow.bricks E/mbgl: {flow.bricks}[Shader]: Shader failed to compile: ERROR: Valid GLSL but not GLSL ES
09-16 13:27:59.065 2938-2938/flow.bricks E/mbgl: {flow.bricks}[Shader]: Vertex shader fill failed to compile: precision highp float;
#ifdef GL_ES
precision highp float;
#else
#define lowp
#define mediump
#define highp
#endif
attribute vec2 a_pos;
uniform mat4 u_matrix;
uniform lowp vec4 u_color;
uniform lowp float u_opacity;
void main() {
lowp vec4 color = u_color;
lowp float opacity = u_opacity;
gl_Position = u_matrix * vec4(a_pos, 0, 1);
}
09-16 13:27:59.066 2938-2938/flow.bricks D/AndroidRuntime: Shutting down VM
And the second one:
--------- beginning of crash
09-16 13:27:59.068 2938-2938/flow.bricks E/AndroidRuntime: FATAL EXCEPTION: main
Process: flow.bricks, PID: 2938
java.lang.Error: Vertex shader fill failed to compile
at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:139)
at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:1377)
at android.view.View.draw(View.java:16178)
at android.view.View.updateDisplayListIfDirty(View.java:15174)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16181)
at android.support.v4.view.ViewPager.draw(ViewPager.java:2415)
at android.view.View.updateDisplayListIfDirty(View.java:15174)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16181)
at android.view.View.updateDisplayListIfDirty(View.java:15174)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15169)
at android.view.View.draw(View.java:15948)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16181)
at com.android.internal.policy.PhoneWindow$DecorView.draw(PhoneWindow.java:2690)
at android.view.View.updateDisplayListIfDirty(View.java:15174)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:281)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:287)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:322)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2615)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2067)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
a
回答1:
Based on the discussion I found at https://github.com/mapbox/react-native-mapbox-gl/issues/415#issue-177023433
I was able to downgrade my Android SDK Tools
to 25.1.7
, and I was able to launch and successfully load the x86 emulator.
I tested this against https://github.com/mapbox/mapbox-android-demo.
Here is the rest of my setup
- macOS El Capitan 10.11.6
- Android Studio 2.2
- Specific to my mapbox-android-demo compile
classpath 'com.android.tools.build:gradle:2.2.0'
supportLibVersion = '24.2.0'
buildToolsVersion '24.0.1'
来源:https://stackoverflow.com/questions/39530601/mapbox-android-sdk-crash-java-lang-error-vertex-shader-fill-failed-to-compil