microg/GmsCore · critical · IllegalStateException

Unable to instantiate the dynamic class com.google.android.g

Error message

Unable to instantiate the dynamic class com.google.android.gms.maps.internal.CreatorImpl

What it means

getCreator() loaded CreatorImpl and accessed its constructor, but newInstance() threw InstantiationException: the class could not be instantiated (e.g. it is abstract, an interface, or initialization of its static blocks failed to surface here). The loader rethrows IllegalStateException with this message, so no ICreator binder can be produced and map init fails.

Source

Thrown at play-services-maps/src/main/java/org/microg/gms/maps/MapsContextLoader.java:78

        }
        return mapsContext;
    }

    public static ICreator getCreator(Context context, @Nullable MapsInitializer.Renderer preferredRenderer) {
        Log.d(TAG, "preferredRenderer: " + preferredRenderer);
        if (creator == null) {
            Log.d(TAG, "Making Creator dynamically");
            try {
                Context mapsContext = getMapsContext(context, preferredRenderer);
                Class<?> clazz = mapsContext.getClassLoader().loadClass("com.google.android.gms.maps.internal.CreatorImpl");
                creator = ICreator.Stub.asInterface((IBinder) clazz.newInstance());
                creator.initV2(ObjectWrapper.wrap(mapsContext.getResources()), Constants.GMS_VERSION_CODE);
            } catch (ClassNotFoundException e) {
                throw new IllegalStateException("Unable to find dynamic class com.google.android.gms.maps.internal.CreatorImpl");
            } catch (IllegalAccessException e) {
                throw new IllegalStateException("Unable to call the default constructor of com.google.android.gms.maps.internal.CreatorImpl");
            } catch (InstantiationException e) {
                throw new IllegalStateException("Unable to instantiate the dynamic class com.google.android.gms.maps.internal.CreatorImpl");
            } catch (RemoteException e) {
                throw new RuntimeRemoteException(e);
            }
        }
        return creator;
    }
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Reinstall/update microG GmsCore (or Play services) maps components from a trusted build.
  2. Align client play-services-maps version with the provider's GMS_VERSION_CODE.
  3. Verify CreatorImpl in the installed provider is a concrete class with a working no-arg constructor.
  4. Catch the IllegalStateException at map init and surface a clear 'maps provider incompatible' message to the user.

Example fix

// before
MapView mapView = new MapView(context);
mapView.onCreate(null); // IllegalStateException: Unable to instantiate ... CreatorImpl
// after
if (!isMapsProviderAvailable(context)) {
    showInstallMicrogDialog();
} else {
    mapView.onCreate(null);
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    mapView.onCreate(savedInstanceState);
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("Unable to instantiate")) {
        showProviderReinstallDialog(); // corrupted/incompatible maps provider
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: The maps context's CreatorImpl class is abstract/instantiation-hostile because a mismatched or corrupted provider build was installed, or class verification failed during static initialization.

Common situations: Partially updated or corrupted microG installation, custom GmsCore builds where CreatorImpl was refactored into an abstract/base class, or binary incompatibility between the client's expected ICreator surface and the provider.

Related errors


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