Since I updated my phone (Samsung Galaxy S7) to the new Android 7.0 two days ago I'm getting sporadically an error when running my app. It occurs sometimes (average every fifth time) when starting the Activity_C
with 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
(full stack trace below)
Activity_C
inherits from Activity_B
which itself inherits from Activity_A
. Activity_A
extends AppCompatActivity
form the package android.support.v7.app
.
Activity A, B and C have a onCreate
method which start like this:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
When the error occurs the savedInstanceState
is defenitly null
. The startActivity
call is always the same (context.startActivity(new Intent(getActivity(), Activity_C.class));
) and from the same activity.
I have searched for hours but found nothing useful. I'm not a newbie but also no expert; but it looks to me so that the problem is not in my activities, but something of the android system stuff.
I'm now using the latest sdk (25) with the appropriate support-packages (25.1.0) but the error also occurs on the sdk v23 I used before. On other devices running Android 5 or 6 everything still works fine.
Does someone know why this problem occurs and how to deal with it?
This is the full stack trace:
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)