microg/GmsCore · error · UnsupportedOperationException

onDestroyView not allowed on StreetViewPanoramaViewDelegate

Error message

onDestroyView not allowed on StreetViewPanoramaViewDelegate

What it means

StreetViewPanoramaViewDelegate.onDestroyView() is intentionally unsupported and throws UnsupportedOperationException unconditionally; view teardown belongs to StreetViewPanoramaView.onDestroy(), not the delegate.

Source

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

            container.removeAllViews();
            container.addView(view);
        } catch (RemoteException e) {
            throw new RuntimeRemoteException(e);
        }
    }

    @Override
    public void onDestroy() {
        try {
            delegate.onDestroy();
        } catch (RemoteException e) {
            throw new RuntimeRemoteException(e);
        }
    }

    @Override
    public void onDestroyView() {
        throw new UnsupportedOperationException("onDestroyView not allowed on StreetViewPanoramaViewDelegate");
    }

    @Override
    public void onInflate(@NonNull Activity activity, @NonNull Bundle options, @Nullable Bundle onInflate) {
        throw new UnsupportedOperationException("onInflate not allowed on StreetViewPanoramaViewDelegate");
    }

    @Override
    public void onLowMemory() {
        try {
            delegate.onLowMemory();
        } catch (RemoteException e) {
            throw new RuntimeRemoteException(e);
        }
    }

    @Override
    public void onPause() {

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Call streetViewPanoramaView.onDestroy() from your Fragment/view teardown instead of the delegate.
  2. Remove onDestroyView forwarding code that targets the delegate.
  3. Let StreetViewPanoramaFragment manage teardown if you use fragments.
  4. Only invoke delegate methods that are actually implemented (onCreate, onResume, onPause, onDestroy, onLowMemory, etc.).

Example fix

// before
@Override
public void onDestroyView() {
    delegate.onDestroyView(); // always throws
}
// after
@Override
public void onDestroyView() {
    streetViewPanoramaView.onDestroy();
}
Defensive patterns

Strategy: type-guard

Type guard

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

Try / catch

try {
    delegate.onDestroyView();
} catch (UnsupportedOperationException e) {
    streetViewPanoramaView.onDestroy(); // correct teardown path
}

Prevention

When it happens

Trigger: Calling delegate.onDestroyView() directly, or a Fragment.onDestroyView() that forwards to the delegate instead of streetViewPanoramaView.onDestroy().

Common situations: Custom Fragment wrappers around Street View, copy-pasted lifecycle forwarding code, or generic lifecycle dispatchers enumerating all delegate methods.

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/7a0dc9658b4a6896. Report an issue: GitHub.