{"record":{"id":"d0b857b4bbab15f0","repo":"microg/GmsCore","slug":"unable-to-find-dynamic-class-com-google-android-gm","errorCode":null,"errorMessage":"Unable to find dynamic class com.google.android.gms.maps.internal.CreatorImpl","messagePattern":"Unable to find dynamic class com\\.google\\.android\\.gms\\.maps\\.internal\\.CreatorImpl","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"play-services-maps/src/main/java/org/microg/gms/maps/MapsContextLoader.java","lineNumber":74,"sourceCode":"                    mapsContext = GooglePlayServicesUtil.getRemoteContext(context);\n                }\n            }\n            MapsContextLoader.mapsContext = mapsContext;\n        }\n        return mapsContext;\n    }\n\n    public static ICreator getCreator(Context context, @Nullable MapsInitializer.Renderer preferredRenderer) {\n        Log.d(TAG, \"preferredRenderer: \" + preferredRenderer);\n        if (creator == null) {\n            Log.d(TAG, \"Making Creator dynamically\");\n            try {\n                Context mapsContext = getMapsContext(context, preferredRenderer);\n                Class<?> clazz = mapsContext.getClassLoader().loadClass(\"com.google.android.gms.maps.internal.CreatorImpl\");\n                creator = ICreator.Stub.asInterface((IBinder) clazz.newInstance());\n                creator.initV2(ObjectWrapper.wrap(mapsContext.getResources()), Constants.GMS_VERSION_CODE);\n            } catch (ClassNotFoundException e) {\n                throw new IllegalStateException(\"Unable to find dynamic class com.google.android.gms.maps.internal.CreatorImpl\");\n            } catch (IllegalAccessException e) {\n                throw new IllegalStateException(\"Unable to call the default constructor of com.google.android.gms.maps.internal.CreatorImpl\");\n            } catch (InstantiationException e) {\n                throw new IllegalStateException(\"Unable to instantiate the dynamic class com.google.android.gms.maps.internal.CreatorImpl\");\n            } catch (RemoteException e) {\n                throw new RuntimeRemoteException(e);\n            }\n        }\n        return creator;\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":86,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-maps/src/main/java/org/microg/gms/maps/MapsContextLoader.java#L56-L86","documentation":"MapsContextLoader.getCreator() loads com.google.android.gms.maps.internal.CreatorImpl from the (resolved) Google Play services / microG maps context via reflection and wraps it as ICreator. When Class.forName-equivalent loadClass fails with ClassNotFoundException, the loader rethrows IllegalStateException with this message. It means the maps provider package is not available or does not export that class on this device/runtime.","triggerScenarios":"First map initialization (MapView.onCreate / MapFragment) when the installed GmsCore/microG build lacks the maps module, the maps context cannot supply CreatorImpl, or a version mismatch removed the class.","commonSituations":"Device without Google Play services or with an outdated/incompatible microG build, microG without the maps add-on module, stripped/fooded GmsCore distributions, or a GMS_VERSION_CODE mismatch against an old provider.","solutions":["Install or update microG GmsCore (or Google Play services) with maps support on the device.","Verify the maps context resolves: ensure the companion/provider package for com.google.android.gms.maps is present and enabled.","Update the play-services-maps client library and microG together so GMS_VERSION_CODE matches the provider.","Catch IllegalStateException around map init and degrade gracefully (e.g. show a fallback view) rather than crashing the app.","If self-hosting microG, build it with the maps module included."],"exampleFix":"// before\nMapView mapView = new MapView(context, options);\nmapView.onCreate(null); // IllegalStateException if CreatorImpl missing\n// after\ntry {\n    mapView.onCreate(null);\n} catch (IllegalStateException e) {\n    showMapUnavailableFallback(); // e.g. prompt user to install/update microG\n}","handlingStrategy":"try-catch","validationCode":"// best-effort pre-check that a maps provider package exists\npublic static boolean mapsProviderLikelyAvailable(Context ctx) {\n    try {\n        ctx.createPackageContext(\"com.google.android.gms\", Context.CONTEXT_INCLUDE_CODE);\n        return true;\n    } catch (Exception e) {\n        return false;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    mapView.onCreate(savedInstanceState);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"dynamic class\")) {\n        promptUserToInstallOrUpdateMicrog();\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify microG/Play services with maps support is installed before showing map UI.","Keep the play-services-maps client and the device provider versions compatible.","Feature-detect maps availability at app start and offer a graceful fallback UI.","Avoid stripped custom GmsCore builds that omit the maps module."],"tags":["android","maps","class-not-found","dynamic-loading","microg"],"backgroundTag":"class-not-found","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}