{"record":{"id":"32a29991b74d52fa","repo":"microg/GmsCore","slug":"oninflate-not-allowed-on-mapviewdelegate","errorCode":null,"errorMessage":"onInflate not allowed on MapViewDelegate","messagePattern":"onInflate not allowed on MapViewDelegate","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"play-services-maps/src/main/java/org/microg/gms/maps/MapViewDelegate.java","lineNumber":89,"sourceCode":"            MapsBundleHelper.transfer(bundle, temp);\n            delegate.onEnterAmbient(temp);\n            MapsBundleHelper.transfer(temp, bundle);\n        } catch (RemoteException e) {\n            throw new RuntimeRemoteException(e);\n        }\n    }\n\n    public void onExitAmbient() {\n        try {\n            delegate.onExitAmbient();\n        } catch (RemoteException e) {\n            throw new RuntimeRemoteException(e);\n        }\n    }\n\n    @Override\n    public void onInflate(@NonNull Activity activity, @NonNull Bundle options, @Nullable Bundle onInflate) {\n        throw new UnsupportedOperationException(\"onInflate not allowed on MapViewDelegate\");\n    }\n\n    @Override\n    public void onLowMemory() {\n        try {\n            delegate.onLowMemory();\n        } catch (RemoteException e) {\n            throw new RuntimeRemoteException(e);\n        }\n    }\n\n    @Override\n    public void onPause() {\n        try {\n            delegate.onPause();\n        } catch (RemoteException e) {\n            throw new RuntimeRemoteException(e);\n        }","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-maps/src/main/java/org/microg/gms/maps/MapViewDelegate.java#L71-L107","documentation":"MapViewDelegate.onInflate(Activity, Bundle, Bundle) is intentionally unsupported: XML-attribute inflation is handled when the MapView is constructed or by MapFragment itself. The delegate throws UnsupportedOperationException unconditionally for this method.","triggerScenarios":"Calling delegate.onInflate(activity, options, savedInstanceState), or a Fragment whose onInflate forwards attributes to the delegate, or inflating the map from XML while manually driving the delegate lifecycle.","commonSituations":"Developers replicating MapFragment's internal inflation path, XML custom-view setups that forward onInflate, and code ported from other Google Play services delegate implementations.","solutions":["Do not call onInflate on the delegate; pass XML attributes to the MapView constructor (MapView(Context, AttributeSet)) instead.","Use MapFragment/SupportMapFragment for XML-based embedding so inflation is handled for you.","Strip onInflate forwarding from custom Fragments wrapping MapView.","If you need options, build TileOverlayOptions/GoogleMapOptions programmatically and pass them to the MapView constructor."],"exampleFix":"// before\n@Override\npublic void onInflate(Activity a, Bundle opts, Bundle s) {\n    delegate.onInflate(a, opts, s); // always throws\n}\n// after\n@Override\npublic void onInflate(Activity a, Bundle opts, Bundle s) {\n    googleMapOptions = GoogleMapOptions.createFromAttributes(context, attrs);\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"public static boolean supportsInflate(LifecycleDelegate d) {\n    return !(d instanceof MapViewDelegate);\n}","tryCatchPattern":"try {\n    delegate.onInflate(activity, options, savedInstanceState);\n} catch (UnsupportedOperationException e) {\n    // parse XML attributes yourself or use MapView(Context, AttributeSet)\n}","preventionTips":["Handle XML attributes via the MapView(Context, AttributeSet) constructor, not the delegate.","Use MapFragment/SupportMapFragment for XML embedding so inflation is managed for you.","Never forward Fragment.onInflate to a MapViewDelegate.","Build GoogleMapOptions programmatically when you need custom options."],"tags":["android","maps","unsupported-operation","lifecycle"],"backgroundTag":"unsupported-operation","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"}