microg/GmsCore · error · UnsupportedOperationException

onCreateView not allowed on StreetViewPanoramaViewDelegate

Error message

onCreateView not allowed on StreetViewPanoramaViewDelegate

What it means

StreetViewPanoramaViewDelegate.onCreateView(LayoutInflater, ViewGroup, Bundle) is deliberately unsupported: StreetViewPanoramaView owns its view creation through its container, so inflation via the delegate is treated as misuse and throws UnsupportedOperationException unconditionally.

Source

Thrown at play-services-maps/src/main/java/org/microg/gms/maps/StreetViewPanoramaViewDelegate.java:34

import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.maps.OnStreetViewPanoramaReadyCallback;
import com.google.android.gms.maps.StreetViewPanorama;
import com.google.android.gms.maps.internal.*;
import com.google.android.gms.maps.model.RuntimeRemoteException;

public class StreetViewPanoramaViewDelegate implements StreetViewLifecycleDelegate {
    private final ViewGroup container;
    private final IStreetViewPanoramaViewDelegate delegate;
    private View view;

    public StreetViewPanoramaViewDelegate(ViewGroup container, IStreetViewPanoramaViewDelegate delegate) {
        this.container = container;
        this.delegate = delegate;
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedInstanceState) {
        throw new UnsupportedOperationException("onCreateView not allowed on StreetViewPanoramaViewDelegate");
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        try {
            Bundle temp = new Bundle();
            MapsBundleHelper.transfer(savedInstanceState, temp);
            delegate.onCreate(temp);
            MapsBundleHelper.transfer(temp, savedInstanceState);
            view = (View) ObjectWrapper.unwrap(delegate.getView());
            container.removeAllViews();
            container.addView(view);
        } catch (RemoteException e) {
            throw new RuntimeRemoteException(e);
        }
    }

    @Override

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Create the panorama via StreetViewPanoramaView (constructed with StreetViewPanoramaOptions) and forward only its supported lifecycle callbacks.
  2. In a Fragment, instantiate StreetViewPanoramaView in onCreateView yourself and return it.
  3. Remove any onCreateView forwarding to the delegate.
  4. Prefer StreetViewPanoramaFragment/SupportStreetViewPanoramaFragment when fragment embedding is acceptable.

Example fix

// before
@Override
public View onCreateView(LayoutInflater inf, ViewGroup p, Bundle s) {
    return delegate.onCreateView(inf, p, s); // always throws
}
// after
@Override
public View onCreateView(LayoutInflater inf, ViewGroup p, Bundle s) {
    streetViewPanoramaView = new StreetViewPanoramaView(getContext(), options);
    streetViewPanoramaView.onCreate(s);
    return streetViewPanoramaView;
}
Defensive patterns

Strategy: type-guard

Type guard

public static boolean supportsViewCreation(LifecycleDelegate d) {
    return !(d instanceof StreetViewPanoramaViewDelegate);
}

Try / catch

try {
    view = delegate.onCreateView(inflater, parent, savedInstanceState);
} catch (UnsupportedOperationException e) {
    view = streetViewPanoramaView; // use the owning view instead
}

Prevention

When it happens

Trigger: Calling streetViewPanoramaViewDelegate.onCreateView(...) directly, or a Fragment's onCreateView forwarding to the delegate instead of using StreetViewPanoramaView.

Common situations: Embedding Street View in custom Fragments with hand-written lifecycle plumbing, porting Google Maps SDK internal delegate usage to microG, or frameworks that invoke every delegate lifecycle method blindly.

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


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