This repository was archived by the owner on Jun 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
App crashes on Android when flutter is reattached to engine #221
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingfixed-in-v4.5.1flutterAffect flutter platformAffect flutter platformv4.5Affects v4.5 releaseAffects v4.5 release
Description
Description
A crash occurs on Android when flutter is reattached to engine.
Expected behavior
There should not be any crash.
Current behavior
Application crashes.
To Reproduce
Steps to reproduce the crash:
- Run an app
- Detach FlutterFragment from FlutterEngine
- Attach FlutterFragment to FlutterEngine
Logs
E/AndroidRuntime(12175): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.flutter.plugin.common.BinaryMessenger io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding.getBinaryMessenger()' on a null object reference
E/AndroidRuntime(12175): at com.arthenica.ffmpegkit.flutter.FFmpegKitFlutterPlugin.onAttachedToActivity(FFmpegKitFlutterPlugin.java:196)
E/AndroidRuntime(12175): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.attachToActivityInternal(FlutterEngineConnectionRegistry.java:362)
E/AndroidRuntime(12175): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.attachToActivity(FlutterEngineConnectionRegistry.java:344)
E/AndroidRuntime(12175): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:176)
E/AndroidRuntime(12175): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:430)
E/AndroidRuntime(12175): at android.app.Activity.performCreate(Activity.java:8006)
E/AndroidRuntime(12175): at android.app.Activity.performCreate(Activity.java:7990)
E/AndroidRuntime(12175): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
E/AndroidRuntime(12175): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3595)
Environment
- Platform: Android
- Flutter Version (if applicable) 2.5.3
- Source branch (if applicable) development-flutter
- Android Studio version (if applicable) 2020.3
Other
Solution should be not to call flutterPluginBinding = null; from onDetachedFromActivity, but to call it from onDetachedFromEngine.
amitrotner and tomerpeled
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixed-in-v4.5.1flutterAffect flutter platformAffect flutter platformv4.5Affects v4.5 releaseAffects v4.5 release