在 SO 和 github 中找不到这个问题的答案。
当我尝试使用从 Mapbox Studio 获得的 URI 加载样式时,我进入loading style failed: "HTTP status code 404了监听器。onDidFailLoadingMap
我已经仔细检查了代码中的 URI 和令牌,并且在 IOS 中一切正常。
该代码类似于 Mapbox 示例中的代码https://docs.mapbox.com/android/maps/examples/use-a-mapbox-studio-style/
如果我放置他们的样式 URI 之一,它也可以正常工作。
Mapbox.getInstance(this, getResources().getString(R.string.my_studio_token));
mapView.onCreate(savedInstanceState);
mapView.addOnDidFailLoadingMapListener(new MapView.OnDidFailLoadingMapListener() {
@Override
public void onDidFailLoadingMap(String errorMessage) {
Log.i("style_load", errorMessage); //gets here after failure
}
});
mapView.getMapAsync(mapboxMap -> {
mapboxMap.setStyle(new Style.Builder().fromUri(getResources().getString(R.string.travily_style_uri)),
style -> Log.i("style_load", style.toString()));
结果我得到一个没有地图的空屏幕。
如果需要,我很乐意添加任何代码片段。
谢谢 :)