{"record":{"id":"7a0dc9658b4a6896","repo":"microg/GmsCore","slug":"ondestroyview-not-allowed-on-streetviewpanoramavie","errorCode":null,"errorMessage":"onDestroyView not allowed on StreetViewPanoramaViewDelegate","messagePattern":"onDestroyView not allowed on StreetViewPanoramaViewDelegate","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"play-services-maps/src/main/java/org/microg/gms/maps/StreetViewPanoramaViewDelegate.java","lineNumber":63,"sourceCode":"            container.removeAllViews();\n            container.addView(view);\n        } catch (RemoteException e) {\n            throw new RuntimeRemoteException(e);\n        }\n    }\n\n    @Override\n    public void onDestroy() {\n        try {\n            delegate.onDestroy();\n        } catch (RemoteException e) {\n            throw new RuntimeRemoteException(e);\n        }\n    }\n\n    @Override\n    public void onDestroyView() {\n        throw new UnsupportedOperationException(\"onDestroyView not allowed on StreetViewPanoramaViewDelegate\");\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 StreetViewPanoramaViewDelegate\");\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() {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-maps/src/main/java/org/microg/gms/maps/StreetViewPanoramaViewDelegate.java#L45-L81","documentation":"StreetViewPanoramaViewDelegate.onDestroyView() is intentionally unsupported and throws UnsupportedOperationException unconditionally; view teardown belongs to StreetViewPanoramaView.onDestroy(), not the delegate.","triggerScenarios":"Calling delegate.onDestroyView() directly, or a Fragment.onDestroyView() that forwards to the delegate instead of streetViewPanoramaView.onDestroy().","commonSituations":"Custom Fragment wrappers around Street View, copy-pasted lifecycle forwarding code, or generic lifecycle dispatchers enumerating all delegate methods.","solutions":["Call streetViewPanoramaView.onDestroy() from your Fragment/view teardown instead of the delegate.","Remove onDestroyView forwarding code that targets the delegate.","Let StreetViewPanoramaFragment manage teardown if you use fragments.","Only invoke delegate methods that are actually implemented (onCreate, onResume, onPause, onDestroy, onLowMemory, etc.)."],"exampleFix":"// before\n@Override\npublic void onDestroyView() {\n    delegate.onDestroyView(); // always throws\n}\n// after\n@Override\npublic void onDestroyView() {\n    streetViewPanoramaView.onDestroy();\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"public static boolean supportsDestroyView(LifecycleDelegate d) {\n    return !(d instanceof StreetViewPanoramaViewDelegate);\n}","tryCatchPattern":"try {\n    delegate.onDestroyView();\n} catch (UnsupportedOperationException e) {\n    streetViewPanoramaView.onDestroy(); // correct teardown path\n}","preventionTips":["Tear down via StreetViewPanoramaView.onDestroy(), not the delegate.","Keep Fragment.onDestroyView forwarding limited to public view APIs.","Prefer panorama fragments so teardown is lifecycle-managed.","Enumerate only supported delegate methods when writing lifecycle glue."],"tags":["android","maps","street-view","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-14T00:17:10.932Z"}