MuntashirAkon/AppManager · error · BadParcelableException
Parcelable protocol requires a non-null Parcelable.Creator o
Error message
Parcelable protocol requires a non-null Parcelable.Creator object called CREATOR on class " + name
What it means
After resolving the CREATOR field, ParcelUtils checks the retrieved value is non-null. A CREATOR field that is declared but never assigned (null) violates the Parcelable protocol and raises BadParcelableException.
Source
Thrown at libcore/io/src/main/java/aosp/android/content/pm/ParcelUtils.java:92
throw new BadParcelableException("Parcelable protocol requires a "
+ "Parcelable.Creator object called "
+ "CREATOR on class " + name);
}
creator = (Parcelable.Creator<?>) f.get(null);
} catch (IllegalAccessException e) {
Log.e(TAG, "Illegal access when unmarshalling: " + name, e);
throw new BadParcelableException(
"IllegalAccessException when unmarshalling: " + name);
} catch (ClassNotFoundException e) {
Log.e(TAG, "Class not found when unmarshalling: " + name, e);
throw new BadParcelableException("ClassNotFoundException when unmarshalling: " + name);
} catch (NoSuchFieldException e) {
throw new BadParcelableException("Parcelable protocol requires a "
+ "Parcelable.Creator object called "
+ "CREATOR on class " + name);
}
if (creator == null) {
throw new BadParcelableException("Parcelable protocol requires a "
+ "non-null Parcelable.Creator object called "
+ "CREATOR on class " + name);
}
map.put(name, creator);
}
}
return creator;
}
}
View on GitHub (pinned to 0152f468fc)
Solutions
- Assign a real Parcelable.Creator instance to the CREATOR field
- Check for static-initializer exceptions that could leave CREATOR null
- Remove leftover scaffolding placeholders and complete the Parcelable implementation
Example fix
// before
public static final Parcelable.Creator<MyData> CREATOR = null;
// after
public static final Parcelable.Creator<MyData> CREATOR = new Parcelable.Creator<MyData>() {
public MyData createFromParcel(Parcel in) { return new MyData(in); }
public MyData[] newArray(int size) { return new MyData[size]; }
}; Defensive patterns
Strategy: validation
Validate before calling
try {
Object c = Class.forName(name, false, loader).getField("CREATOR").get(null);
if (c == null) throw new IllegalStateException("CREATOR is null on " + name);
} catch (ReflectiveOperationException e) { /* handle */ } Try / catch
try {
T p = ParcelUtils.readParcelable(parcel, loader);
} catch (BadParcelableException e) {
Log.e(TAG, "Null CREATOR — check static init of " + name, e);
} Prevention
- Initialize CREATOR inline; never leave it null
- Watch for static-init exceptions in Parcelable classes
- Unit-test createFromParcel for every Parcelable
When it happens
Trigger: A Parcelable class declares CREATOR but initializes it to null (or assigns it in a static block/constructor that fails or hasn't run), and the class is read from a parcel.
Common situations: Placeholder CREATOR = null left from scaffolding; static initialization order/exception leaving CREATOR null; bytecode transformations stripping the initializer.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Can't unparcel type " + actual.getName() + " in list of type
- Parcelable protocol requires that the class implements Parce
- Parcelable protocol requires a Parcelable.Creator object cal
- ClassNotFoundException when unmarshalling: " + name
- Empty profile path
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/d24edb27207793cb.
Report an issue: GitHub.