android - Skobbler Android 预 bundle 错误

标签 android dictionary offline skmaps

我正在使用 Android 版 Skobbler map API,到目前为止效果非常好。 按照官方的“操作方法”,我已经能够将 map 实现到我的应用程序中。 我可以让应用程序下载 map 并离线使用。

但我的目标是拥有一张预 bundle 的离线 map 。 我已经完成了“如何”中的所有步骤,但它不起作用,我不断收到错误

10-31 06:54:50.347: D/SKMaps(15168): SKMapSurfaceView----Saved  map cache state  [ Map Region zoom=17.0 center= [13.385000228881836,52.51665115356445]]  [Display mode=MODE_2D]   [Follower mode=NONE]   [Compass shown=false Position = [0.0 ,0.0] ]  [Rotation=true ] [Panning=true][Zooming=true]   [Bearing=0.0] [Annotations=0]
10-31 06:54:50.357: E/BitmapFactory(15168): Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.example.myskobblermapbasic/files/SKMaps/res/xhdpi/icon_map_popup_navigate.png: open failed: ENOENT (No such file or directory)
10-31 06:54:50.367: E/BitmapFactory(15168): Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.example.myskobblermapbasic/files/SKMaps/res/xhdpi/icon_map_popup_arrow.png: open failed: ENOENT (No such file or directory)
10-31 06:54:50.377: D/SKMaps(15168): SKMapSurfaceView---- centerMapOnPosition [19.8171,41.3294]
10-31 06:54:50.377: D/SKMaps(15168): SKMapSurfaceView---- ON RESUME 
10-31 06:54:50.527: D/SKMaps(15168): MapRenderer----onSurfaceCreated
10-31 06:54:50.527: W/Settings(15168): Setting always_finish_activities has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
10-31 06:54:50.527: D/SKMaps(15168): MapRenderer---- LinInitialized = true 
10-31 06:54:50.527: D/SKMaps(15168): MapRenderer----SetInitSurfaceSetup 
10-31 06:54:50.527: E/Adreno-ES11(15168): <qglDrvAPI_glDeleteTextures:371>: GL_INVALID_VALUE
10-31 06:54:50.527: A/libc(15168): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 15226 (GLThread 664)

似乎只要我将离线 map 插入到zip中,就会产生错误。

这是我的主要 Activity :

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        SKLogging.enableLogs(true);
        File externalDir = getExternalFilesDir(null);

        // determine path where map resources should be copied on the device
        if (externalDir != null) {
            mapResourcesDirPath = externalDir + "/SKMaps/";
        } else {
            mapResourcesDirPath = getFilesDir() + "/SKMaps/";
        }

        new SKPrepareMapTextureThread(this, mapResourcesDirPath, "SKMaps.zip", this).start();
    }

    @Override
    public void onMapTexturesPrepared(boolean prepared) {
        if(prepared){
            initializeLibrary();
            startActivity(new Intent(MainActivity.this, MapActivity.class));
        }else{
            Toast.makeText(MainActivity.this, "Map resources are not prepared", Toast.LENGTH_SHORT).show();
        }
    }

    /**
     * Initializes the SKMaps framework
     */
    private void initializeLibrary() {
        SKMapsInitSettings initMapSettings = new SKMapsInitSettings();
        // set path to map resources and initial map style
        initMapSettings.setMapResourcesPaths(mapResourcesDirPath,
                new SKMapViewStyle(mapResourcesDirPath + "/outdoorstyle/", "outdoorstyle.json"));

        // EXAMPLE OF ADDING PREINSTALLED MAPS
        initMapSettings.setPreinstalledMapsPath(mapResourcesDirPath + "/PreinstalledMaps");
        //initMapSettings.setConnectivityMode(SKMaps.CONNECTIVITY_MODE_OFFLINE);

        SKMaps.getInstance().initializeSKMaps(this, initMapSettings, API_KEY);
    }

和我的 MapActivity:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);

        SKMapViewHolder mapViewGroup = (SKMapViewHolder) findViewById(R.id.map_surface_holder);
        mapView = mapViewGroup.getMapSurfaceView();
        mapView.centerMapOnPosition(new SKCoordinate(19.8171, 41.3294));
    }

    @Override
    protected void onPause() {
        super.onPause();
        mapView.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mapView.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        SKMaps.getInstance().destroySKMaps();
        android.os.Process.killProcess(android.os.Process.myPid());
    }

谢谢,

最佳答案

检查您的 SKMaps.zip 包含以下文件:

SKMaps/res/xhdpi/icon_map_popup_arrow.png
SKMaps/res/xhdpi/icon_map_popup_navigate.png

如果没有,您应该添加它们。

关于android - Skobbler Android 预 bundle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26668548/

相关文章:

Android BLE 扫描与 UUID 过滤器列表混淆

python - 我正在尝试使用 dict 构建一个 sqlalchemy 引擎,该引擎具有从 tkinter 解析到它的变量

Xcode 3.2 离线文档?

html - 将整个文件夹添加到 HTML5 应用程序缓存

javascript - 离线移动Web应用程序存储

java - 应用程序无响应且用户权限错误

java - Android NumberPicker 对 Gingerbread 的限制

java - 如何根据某些属性使用 RxJava2 对 ArrayList 进行分组?

python - 为什么用 zip 启动的带有元组键的字典会在更新单个键时更新所有键?

python - 连接来自 pickle 的 pandas 数据帧与来自内存字典的 pandas 数据帧 - 为什么内存中会失败?