3

自从两天前我将手机(三星 Galaxy S7)更新到新的 Android 7.0 后,我在运行我的应用程序时偶尔会出现错误。它有时会在开始时发生(平均每五次)Activity_Cwith startActivity

java.lang.RuntimeException: Unable to start activity ComponentInfo{de.my.app/de.my.app.gui.Activity_C}: java.lang.IllegalStateException: Bad magic number for Bundle: 0x620061 (下面的完整堆栈跟踪)

Activity_C继承自Activity_B其自身继承自Activity_AActivity_AAppCompatActivity包中扩展android.support.v7.app

活动 A、B 和 C 有一个onCreate这样开始的方法:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

当错误发生时,savedInstanceState肯定是nullstartActivity调用总是相同的 ( )context.startActivity(new Intent(getActivity(), Activity_C.class));并且来自相同的活动。

我已经搜索了几个小时,但没有发现任何有用的东西。我不是新手,也不是专家;但在我看来,问题不在于我的活动,而在于 android 系统的东西。

我现在正在使用最新的 sdk (25) 和适当的支持包 (25.1.0),但我之前使用的 sdk v23 也会出现错误。在其他运行 Android 5 或 6 的设备上,一切仍然正常。

有人知道为什么会出现这个问题以及如何处理它吗?

这是完整的堆栈跟踪:

01-27 21:36:45.241 9953-9953/de.my.app E/AndroidRuntime: FATAL EXCEPTION: main
                                                        Process: de.my.app, PID: 9953
                                                        java.lang.RuntimeException: Unable to start activity ComponentInfo{de.my.app/de.my.app.gui.Activity_C}: java.lang.IllegalStateException: Bad magic number for Bundle: 0x620061
                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2947)
                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
                                                            at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                            at android.os.Looper.loop(Looper.java:154)
                                                            at android.app.ActivityThread.main(ActivityThread.java:6688)
                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
                                                         Caused by: java.lang.IllegalStateException: Bad magic number for Bundle: 0x620061
                                                            at android.os.BaseBundle.readFromParcelInner(BaseBundle.java:1443)
                                                            at android.os.BaseBundle.<init>(BaseBundle.java:128)
                                                            at android.os.Bundle.<init>(Bundle.java:69)
                                                            at android.os.Parcel.readBundle(Parcel.java:1888)
                                                            at android.os.Parcel.readBundle(Parcel.java:1872)
                                                            at android.content.pm.PackageItemInfo.<init>(PackageItemInfo.java:466)
                                                            at android.content.pm.ApplicationInfo.<init>(ApplicationInfo.java:1311)
                                                            at android.content.pm.ApplicationInfo.<init>(ApplicationInfo.java)
                                                            at android.content.pm.ApplicationInfo$1.createFromParcel(ApplicationInfo.java:1303)
                                                            at android.content.pm.ApplicationInfo$1.createFromParcel(ApplicationInfo.java:1302)
                                                            at android.content.pm.ComponentInfo.<init>(ComponentInfo.java:228)
                                                            at android.content.pm.ActivityInfo.<init>(ActivityInfo.java:1025)
                                                            at android.content.pm.ActivityInfo.<init>(ActivityInfo.java)
                                                            at android.content.pm.ActivityInfo$1.createFromParcel(ActivityInfo.java:1017)
                                                            at android.content.pm.ActivityInfo$1.createFromParcel(ActivityInfo.java:1016)
                                                            at android.content.pm.IPackageManager$Stub$Proxy.getActivityInfo(IPackageManager.java:3157)
                                                            at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:484)
                                                            at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:301)
                                                            at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:281)
                                                            at android.support.v7.app.AppCompatDelegateImplV9.onCreate(AppCompatDelegateImplV9.java:157)
                                                            at android.support.v7.app.AppCompatDelegateImplV14.onCreate(AppCompatDelegateImplV14.java:60)
                                                            at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:76)
                                                            at de.my.app.gui.Activity_A.onCreate(Activity_A.java:39)
                                                            at de.my.app.gui.Activity_B.onCreate(Activity_B.java:43)
                                                            at de.my.app.gui.Activity_C.onCreate(Activity_C.java:50)
                                                            at android.app.Activity.performCreate(Activity.java:6912)
                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2900)
                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008) 
                                                            at android.app.ActivityThread.-wrap14(ActivityThread.java) 
                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
                                                            at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                            at android.os.Looper.loop(Looper.java:154) 
                                                            at android.app.ActivityThread.main(ActivityThread.java:6688) 
                                                            at java.lang.reflect.Method.invoke(Native Method) 
                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 
                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 
4

0 回答 0