{"record":{"id":"e45fdb6c471596b9","repo":"microg/GmsCore","slug":"unable-to-call-the-default-constructor-of-com-goog","errorCode":null,"errorMessage":"Unable to call the default constructor of com.google.android.gms.maps.internal.CreatorImpl","messagePattern":"Unable to call the default constructor of 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":76,"sourceCode":"            }\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":58,"sourceCodeEnd":86,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-maps/src/main/java/org/microg/gms/maps/MapsContextLoader.java#L58-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use an unmodified, up-to-date microG/Play services maps build where CreatorImpl has a public default constructor.","Add ProGuard/R8 keep rules: -keep class com.google.android.gms.maps.internal.CreatorImpl { <init>(); } if building the provider yourself.","Check for a SecurityManager or custom ClassLoader blocking setAccessible/instantiation in embedded environments.","Update both client library and provider to matching versions before further debugging."],"exampleFix":"// before (proguard-rules.pro)\n# no keep rule -> constructor stripped/inaccessible\n// after\n-keep class com.google.android.gms.maps.internal.CreatorImpl {\n    public <init>();\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    mapView.onCreate(savedInstanceState);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"default constructor\")) {\n        Log.e(TAG, \"Maps provider CreatorImpl not instantiable; update microG/Play services\", e);\n        showMapUnavailableFallback();\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use official, unmodified microG/Play services builds with correct CreatorImpl visibility.","If building the provider yourself, add keep rules preserving CreatorImpl's public no-arg constructor.","Keep client library and provider on matching versions.","Test map initialization on clean devices with only your app plus microG installed."],"tags":["android","maps","reflection","instantiation-failed","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"}