microg/GmsCore · error · RuntimeException

Can't construct object

Error message

Can't construct object

What it means

Wraps a reflection failure in SafeParcelReflectionUtil.createObject: the no-arg Constructor of the AutoSafeParcelable subclass could not be invoked (missing, inaccessible, or instantiation failed). The cause is chained; the faulty input is the parcelled class lacking a usable constructor.

Source

Thrown at play-services-basement/src/main/java/org/microg/safeparcel/SafeParcelReflectionUtil.java:46

    private static final String TAG = "SafeParcel";

    private SafeParcelReflectionUtil() {
    }

    @Deprecated
    public static <T extends AutoSafeParcelable> T createObject(Class<T> tClass, Parcel in) {
        ClassDescriptor<T> descriptor = new ClassDescriptor<>(tClass);
        return createObject(in, descriptor);
    }

    public static <T extends AutoSafeParcelable> T createObject(Parcel in, ClassDescriptor<T> descriptor) {
        try {
            Constructor<T> constructor = descriptor.constructor;
            T t = constructor.newInstance();
            readObject(t, in, descriptor);
            return t;
        } catch (Exception e) {
            throw new RuntimeException("Can't construct object", e);
        }
    }

    @Deprecated
    public static void writeObject(AutoSafeParcelable object, Parcel parcel, int flags) {
        if (object == null)
            throw new NullPointerException();
        Class<?> clazz = object.getClass();
        ClassDescriptor<?> descriptor = new ClassDescriptor<>(clazz);
        writeObject(object, parcel, flags, descriptor);
    }

    public static <T extends AutoSafeParcelable> void writeObject(T object, Parcel parcel, int flags, ClassDescriptor<?> descriptor) {
        int start = SafeParcelWriter.writeObjectHeader(parcel);
        for (ClassDescriptor.FieldDescriptor fieldDescriptor : descriptor.fields.values()) {
            try {
                writeField(object, parcel, flags, fieldDescriptor);
            } catch (Exception e) {

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Give the parcelled class a public no-arg constructor
  2. Ensure the class is non-abstract and accessible to reflection
  3. Catch the exception and treat the parcel as unreadable for that type
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at play-services-basement/src/main/java/org/microg/safeparcel/SafeParcelReflectionUtil.java:46 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/5717e121b3b9cba0. Report an issue: GitHub.