microg/GmsCore · error · UnsupportedOperationException
onInflate not allowed on MapViewDelegate
Error message
onInflate not allowed on MapViewDelegate
What it means
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.
Source
Thrown at play-services-maps/src/main/java/org/microg/gms/maps/MapViewDelegate.java:89
MapsBundleHelper.transfer(bundle, temp);
delegate.onEnterAmbient(temp);
MapsBundleHelper.transfer(temp, bundle);
} catch (RemoteException e) {
throw new RuntimeRemoteException(e);
}
}
public void onExitAmbient() {
try {
delegate.onExitAmbient();
} catch (RemoteException e) {
throw new RuntimeRemoteException(e);
}
}
@Override
public void onInflate(@NonNull Activity activity, @NonNull Bundle options, @Nullable Bundle onInflate) {
throw new UnsupportedOperationException("onInflate not allowed on MapViewDelegate");
}
@Override
public void onLowMemory() {
try {
delegate.onLowMemory();
} catch (RemoteException e) {
throw new RuntimeRemoteException(e);
}
}
@Override
public void onPause() {
try {
delegate.onPause();
} catch (RemoteException e) {
throw new RuntimeRemoteException(e);
}View on GitHub (pinned to 157c9d86ac)
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.
Example fix
// before
@Override
public void onInflate(Activity a, Bundle opts, Bundle s) {
delegate.onInflate(a, opts, s); // always throws
}
// after
@Override
public void onInflate(Activity a, Bundle opts, Bundle s) {
googleMapOptions = GoogleMapOptions.createFromAttributes(context, attrs);
} Defensive patterns
Strategy: type-guard
Type guard
public static boolean supportsInflate(LifecycleDelegate d) {
return !(d instanceof MapViewDelegate);
} Try / catch
try {
delegate.onInflate(activity, options, savedInstanceState);
} catch (UnsupportedOperationException e) {
// parse XML attributes yourself or use MapView(Context, AttributeSet)
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Developers replicating MapFragment's internal inflation path, XML custom-view setups that forward onInflate, and code ported from other Google Play services delegate implementations.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- onCreateView not allowed on MapViewDelegate
- onDestroyView not allowed on MapViewDelegate
- onCreateView not allowed on StreetViewPanoramaViewDelegate
- onDestroyView not allowed on StreetViewPanoramaViewDelegate
- onInflate not allowed on StreetViewPanoramaViewDelegate
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/32a29991b74d52fa.
Report an issue: GitHub.