Проблема с разрушением движка флаттера

Я добавил флаттер в существующее приложение для Android, используя движок prewarm flutter.

var flutterEngine = FlutterEngineCache.getInstance().get(Constants.FLUTTER_ENGINE)

        if (flutterEngine == null) {
            flutterEngine = FlutterEngine(this)
            FlutterEngineCache.getInstance().put(Constants.FLUTTER_ENGINE, flutterEngine)
            flutterEngine.navigationChannel.setInitialRoute(
                "route1"
            )
            flutterEngine.dartExecutor.executeDartEntrypoint(
                DartExecutor.DartEntrypoint.createDefault()
            )
        }

Когда я разрушаю флаттер-двигатель FlutterEngineCache.getInstance().get(Constants.FLUTTER_ENGINE)?.destroy()Я получаю следующую ошибку.

java.lang.RuntimeException: Unable to destroy activity: java.lang.RuntimeException: Cannot execute operation because FlutterJNI is not attached to native.

  Caused by: java.lang.RuntimeException: Cannot execute operation because FlutterJNI is not attached to native.
        at io.flutter.embedding.engine.FlutterJNI.ensureAttachedToNative(FlutterJNI.java:222)
        at io.flutter.embedding.engine.FlutterJNI.onSurfaceDestroyed(FlutterJNI.java:315)
        at io.flutter.embedding.engine.renderer.FlutterRenderer.stopRenderingToSurface(FlutterRenderer.java:207)
        at io.flutter.embedding.android.FlutterView.detachFromFlutterEngine(FlutterView.java:795)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDestroyView(FlutterActivityAndFragmentDelegate.java:442)
        at

0 ответов

Другие вопросы по тегам