当用户在经过足够的延迟(或设置了“不保留 Activity ”开发选项)后使用MapViewLite组件重新进入屏幕时,发生崩溃。它不依赖于调用代码中的任何内容-即使在SDK附带的裸露的“HelloMapLite”示例项目中也会发生。
这里使用的是精简版:4.4.0.2.2340(但我是在4.3.3.0.2052版上首次发现的)

 Caused by: java.lang.RuntimeException: bad array lengths
    at android.os.Parcel.readByteArray(Parcel.java:2249)
    at com.here.sdk.mapviewlite.MapViewLite$SavedState.<init>(Unknown Source:8)
    at com.here.sdk.mapviewlite.MapViewLite$SavedState.<init>(Unknown Source:0)
    at com.here.sdk.mapviewlite.MapViewLite$SavedState$1.createFromParcel(Unknown Source:3)
    at com.here.sdk.mapviewlite.MapViewLite$SavedState$1.createFromParcel(Unknown Source:0)
    at android.os.Parcel.readParcelable(Parcel.java:2790)
    at android.os.Parcel.readValue(Parcel.java:2684)
    at android.os.Parcel.readSparseArrayInternal(Parcel.java:3134)
    at android.os.Parcel.readSparseArray(Parcel.java:2367)
    at android.os.Parcel.readValue(Parcel.java:2741)
    at android.os.Parcel.readArrayMapInternal(Parcel.java:3053)
    at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:288)
    at android.os.BaseBundle.unparcel(BaseBundle.java:232)
    at android.os.Bundle.getSparseParcelableArray(Bundle.java:1010)
    at androidx.fragment.app.FragmentStateManager.restoreState(FragmentStateManager.java:236)
自动反编译的MapViewLite代码:
public Parcelable onSaveInstanceState() {
    Parcelable var1 = super.onSaveInstanceState();
    MapRenderer var2;
    if ((var2 = this.mNativeRenderer) != null) {
        MapViewLite var10000 = this;
        byte[] var3 = var2.saveViewState();
        byte[] var4 = var10000.getMapScene().saveLayersState();
        return new MapViewLite.SavedState(var1, var3, var4);
    } else {
        return var1;
    }
}

public void onRestoreInstanceState(Parcelable var1) {
    if (var1 instanceof MapViewLite.SavedState && this.mNativeRenderer != null) {
        MapViewLite var10000 = this;
        MapViewLite var10001 = this;
        MapViewLite.SavedState var2;
        super.onRestoreInstanceState((var2 = (MapViewLite.SavedState)var1).getSuperState());
        var10001.mNativeRenderer.restoreViewState(var2.getViewState());
        var10000.getMapScene().restoreLayersState(var2.getLayersState());
    } else {
        super.onRestoreInstanceState(var1);
    }
}

最佳答案

似乎此错误已在4.4.3.0版中修复。对我来说,它不再是可复制的,并且根据发行说明,此错误已通过 HERE SDK for Android(精简版)4.4.3.0版修复。 :“修复了应用从后台返回到MapViewLiteActivity崩溃的问题。”。

10-08 01:30