-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
When an engine is detached from a FlutterActivity. FlutterActivity.release is called. This eventually leads down to calling PlatformViewsController.destroyOverlaySurfaces. And when the cached engine is detached from an Activity and reused with a new Activity this leads to:
E/flutter: [ERROR:flutter/shell/platform/android/platform_view_android_jni_impl.cc(49)] java.lang.IllegalStateException: The overlay surface (id:0) doesn't exist
at io.flutter.plugin.platform.PlatformViewsController.onDisplayOverlaySurface(PlatformViewsController.java:796)
at io.flutter.embedding.engine.FlutterJNI.onDisplayOverlaySurface(FlutterJNI.java:960)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
A/flutter: [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1414)] Check failed: CheckException(env).
A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 15403 (e.myapplication), pid 15403 (e.myapplication)
Despite that, the old PlatformViews are attached to the old Activity, so all references should/will be removed. So I believe the only way Flutter could support detaching a cached engine containing PlatformViews and restarting a new Activity with it, is if it recreated all the PlatformViews with the new Activity and their creation arguments. (e.g. PlatformViewFactory.create).
LongXiangGuo, houziruinb87, FrantisekGazo and tomekit
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team