XXX在Android的偏移YYY

XXX在Android的偏移YYY

本文介绍了如何修复解组未知类型code XXX在Android的偏移YYY?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,因为解组异常恢复应用程序崩溃。我已经检查了所有的Serializables有构造函数使用ObjectStream时没有参数,甚至检查了所有的serializables(保存到文件,从文件和加载)。我怎样才能了解实际的类类型parcelable偏移导致异常:

I'm having app crash on resume because of Unmarshalling exception. I've checked all the Serializables have constructor with no parameters and even checked all the serializables using ObjectStream (save to file and load from file). How can i understand actual class type for parcelable offset that cause exception:

Parcel android.os.Parcel@42209460: Unmarshalling unknown type code
 2131165303 at offset 3748
         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2080)
         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2105)
         at android.app.ActivityThread.access$600(ActivityThread.java:136)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
         at android.os.Handler.dispatchMessage(Handler.java:99)
         at android.os.Looper.loop(Looper.java:137)
         at android.app.ActivityThread.main(ActivityThread.java:4876)
         at java.lang.reflect.Method.invokeNative(Native Method)
         at java.lang.reflect.Method.invoke(Method.java:511)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:804)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:571)
         at com.kdgdev.xtension.core.XtensionMain.main(XtensionMain.java:91)
         at dalvik.system.NativeStart.main(Native Method)
        Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@42209460: Unmarshalling unknown type code 2131165303
 at offset 3748
         at android.os.Parcel.readValue(Parcel.java:2032)
         at android.os.Parcel.readSparseArrayInternal(Parcel.java:2255)
         at android.os.Parcel.readSparseArray(Parcel.java:1687)
         at android.os.Parcel.readValue(Parcel.java:2022)
         at android.os.Parcel.readMapInternal(Parcel.java:2226)
         at android.os.Bundle.unparcel(Bundle.java:223)
         at android.os.Bundle.getSparseParcelableArray(Bundle.java:1232)
        at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1690)
         at android.app.Activity.onRestoreInstanceState(Activity.java:999)
         at com.actionbarsherlock.app.SherlockFragmentActivity.onRestoreInstanceState(Unknown
 Source)
         at name.myname.android.app.ui.MainActivity.onRestoreInstanceState(Unknown
 Source)
         at android.app.Activity.performRestoreInstanceState(Activity.java:971)
         at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1130)
         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2058)
       ... 12 more

保存的数据包括的捆绑序列化和所有的人都看好。

Saved data consists of Bundles and Serializables and all of them look good.

我会做下:

try {
// unmarshalling
} catch (Throwable t) {
// look offset
}

我怎样才能了解什么类型实际上是Parcelable偏移?

How can i understand what type is actually for Parcelable offset?

推荐答案

这是因为Proguard的混淆 - 它处理Parcelable。解决办法:<一href="http://stackoverflow.com/questions/21342700/proguard-causing-runtimeexception-unmarshalling-unknown-type-$c$c-in-parcelabl">Proguard造成的RuntimeException(解组未知类型code)在Parcelable类

It's because of Proguard obfuscation - it processed Parcelable.solution: Proguard causing RuntimeException (Unmarshalling unknown type code) in Parcelable class

这篇关于如何修复解组未知类型code XXX在Android的偏移YYY?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 07:46