【问题标题】:MapBox: Shader failed to compile: ERROR: Valid GLSL but not GLSL ESMapBox:着色器无法编译:错误:有效的 GLSL 但不是 GLSL ES
【发布时间】:2016-08-04 14:08:12
【问题描述】:

尝试在我的应用中加载 MapBox 视图时出现此错误。我的代码有问题吗?

测试信息:

Nexus 5X (API 23) Android 6.0 x86_64 模拟器,Android Studio 2.2 Preview 7 (Mac)

分级:

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.1@aar') {
    transitive = true
}

地图活动:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_map);

    MapboxAccountManager.start(this, getString(R.string.accessToken));

    // Create a mapView
    mapView = (MapView) findViewById(R.id.mapview);
    // Doesn't work without using deprecated setAccessToken... bug??
    mapView.setAccessToken(getString(R.string.accessToken));

    mapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(MapboxMap mapboxMap) {

        }
    });
    mapView.onCreate(savedInstanceState);
}

XML:

<com.mapbox.mapboxsdk.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    mapbox:style_url="@string/style_mapbox_streets"
    mapbox:center_latitude="41.885"
    mapbox:center_longitude="-87.679"
    mapbox:zoom="12"
    mapbox:tilt="20" />

日志:

E/mbgl: [Shader]: Shader failed to compile: ERROR: Valid GLSL but not GLSL ES
E/mbgl: [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;

        void main() {
                gl_Position = u_matrix * vec4(a_pos, 0, 1);
        }
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadcab1 in tid 22621 

【问题讨论】:

  • 另外,请编辑您的测试信息(例如,设备与模拟器、arm 与 x86)。
  • @RobLabs 更新了信息
  • doovers — 谢谢。是的,我认为这与提到的相似/重复。我和你有同样的设置,我得到了同样的错误。手臂设备工作正常。我已经回滚到 4.0.0,所以我可以在模拟器上测试。
  • @RobLabs 好的,我现在将与 Arm 合作,所以...你知道这个问题在 GitHub 上被跟踪吗?

标签: android glsl mapbox


【解决方案1】:

您使用的是哪个版本的 Android Studio,您是在模拟器还是物理设备上运行您的应用?经过测试并能够使用工作室的测试版而不是稳定版进行制作。

附注:

MapboxAccountManager.start(this, getString(R.string.accessToken));

如果您在 XML 中有地图视图,则需要在 setContentView() 之前进行。

【讨论】:

  • 使用请求的信息更新问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多