2016-08-04 82 views
1

我在嘗試在我的應用中加載MapBox視圖時出現此錯誤。我在代碼中出錯了嗎?MapBox:Shader無法編譯:錯誤:有效的GLSL但不是GLSL ES

測試信息:

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

搖籃:

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]') { 
    transitive = true 
} 

MapActivity:

@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 
+0

重複http://stackoverflow.com/questions/38538157/mapbox-android-application-crashes-after-update-to-sdk-4-1-0-on-emulator/ – RobLabs

+0

另外,請編輯您的測試信息(例如,設備與仿真器,手臂與x86)。 – RobLabs

+0

@RobLabs更新了信息 – doovers

回答

1

你在模擬器上或物理設備上運行你在使用Android工作室的版本和您的應用程序?經過測試並能夠使用工作室的測試版製作而不是穩定版。

一個側面說明:

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

需要,如果你有在XML中的MapView的setContentView()之前去。

+0

更新了所需信息的問題 – doovers