Skobbler 地图从后台返回后崩溃

Skobbler Map crashes after returning from background

我正在开发一个使用 skobbler sdk 2.4 的应用程序,当我打开地图然后转到后台并打开一个需要大量内存的应用程序时遇到了一个问题,比如《部落冲突》:P。

几秒钟后,当我 return 到包含地图的 activity 时,它变黑了,2 秒后,它给 logcat 报了这个错误:

A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x44 in tid 27000 (GLThread 72284)

我用 sdk 附带的示例尝试了同样的事情,起初它崩溃了,因为它找不到保存在应用程序实例中的字符串路径。我已针对此问题制定了解决方法并修复了来自应用程序 class DemoApplication 的空异常崩溃。这不是问题。问题出在地图上。

在此之后我去了同一点,即使使用示例应用程序我也遇到了同样的问题。 activity 进入后台后,地图崩溃并且无法再次自行初始化。

欢迎任何建议:)

感谢 SylviA,在我检查我的示例应用程序时,我试图修复空指针异常问题并通过电子邮件发送。

当我第二次编写代码时,我意识到我做错了什么,这就是这次荒谬的崩溃的原因。

我在这里发布了我在 MapActivity.class 中初始化地图时所做更改的代码的一部分。这些更改是在 DemoUtils.class

内进行的
/**
 * Initializes the SKMaps framework
 */
public static void initializeLibrary(final Context context) {
    final DemoApplication app = (DemoApplication)context.getApplicationContext();
    // get object holding map initialization settings
    SKMapsInitSettings initMapSettings = new SKMapsInitSettings();
    // set path to map resources and initial map style

    SharedPreferences mSharedPreferences = context.getSharedPreferences("map",0);
    if(app.getMapResourcesDirPath()==null) { // here happens the first error
        Toast.makeText(context,"Null Exception Error avoided", Toast.LENGTH_SHORT).show();
        app.setMapResourcesDirPath(mSharedPreferences.getString("map_path",null));
    }else {
        SharedPreferences.Editor mEditor = mSharedPreferences.edit();
        mEditor.putString("map_path",app.getMapResourcesDirPath());
        mEditor.commit();
    }

    initMapSettings.setMapResourcesPaths(app.getMapResourcesDirPath(),
            new SKMapViewStyle(app.getMapResourcesDirPath() + "daystyle/", "daystyle.json"));

我错在这一行,是这样的:

initMapSettings.setMapResourcesPaths(app.getMapResourcesDirPath(),
            new SKMapViewStyle( null + "daystyle/", "daystyle.json"));

而且必须这样做:

initMapSettings.setMapResourcesPaths(app.getMapResourcesDirPath(),
            new SKMapViewStyle( app.getMapResourcesDirPath() + "daystyle/", "daystyle.json"));

感谢您的宝贵时间:)