gpt4 book ai didi

android - MapBox:着色器编译失败:错误:有效的 GLSL 但不是 GLSL ES

转载 作者:行者123 更新时间:2023-11-30 01:07:14 25 4
gpt4 key购买 nike

尝试在我的应用程序中加载 MapBox View 时出现此错误。我在代码中出错了吗?

测试信息:

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

Gradle :

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

map Activity :

@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

最佳答案

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

旁注:

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

如果您的 map View 包含在 XML 中,则需要在 setContentView() 之前执行。

关于android - MapBox:着色器编译失败:错误:有效的 GLSL 但不是 GLSL ES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38769716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com