microg/GmsCore · critical · IllegalStateException

Unable to call the default constructor of com.google.android

Error message

Unable to call the default constructor of com.google.android.gms.maps.internal.CreatorImpl

What it means

getCreator() successfully loaded CreatorImpl but clazz.newInstance() threw IllegalAccessException, meaning the class's no-arg constructor is not accessible to the caller. The loader converts this into IllegalStateException with this message. This indicates a visibility/security-manager or obfuscation issue around the provider's CreatorImpl default constructor.

Source

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

            }
            MapsContextLoader.mapsContext = mapsContext;
        }
        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. Use an unmodified, up-to-date microG/Play services maps build where CreatorImpl has a public default constructor.
  2. Add ProGuard/R8 keep rules: -keep class com.google.android.gms.maps.internal.CreatorImpl { <init>(); } if building the provider yourself.
  3. Check for a SecurityManager or custom ClassLoader blocking setAccessible/instantiation in embedded environments.
  4. Update both client library and provider to matching versions before further debugging.

Example fix

// before (proguard-rules.pro)
# no keep rule -> constructor stripped/inaccessible
// after
-keep class com.google.android.gms.maps.internal.CreatorImpl {
    public <init>();
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    mapView.onCreate(savedInstanceState);
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("default constructor")) {
        Log.e(TAG, "Maps provider CreatorImpl not instantiable; update microG/Play services", e);
        showMapUnavailableFallback();
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Dynamic load of com.google.android.gms.maps.internal.CreatorImpl where the default constructor is non-public, package-private, or blocked by R8/ProGuard stripping or a restrictive SecurityManager in the maps context classloader.

Common situations: ProGuard/R8 keep rules missing for CreatorImpl in a custom GmsCore build, a hand-patched microG maps module with changed constructor visibility, or classloader isolation between the app and provider process.

Related errors


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