Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes on Android when flutter is reattached to engine #221

Closed
yanivshaked opened this issue Nov 3, 2021 · 3 comments
Closed

App crashes on Android when flutter is reattached to engine #221

yanivshaked opened this issue Nov 3, 2021 · 3 comments
Assignees
Labels
bug Something isn't working fixed-in-v4.5.1 flutter Affect flutter platform v4.5 Affects v4.5 release

Comments

@yanivshaked
Copy link
Contributor

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:

  1. Run an app
  2. Detach FlutterFragment from FlutterEngine
  3. 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.

@tanersener
Copy link
Collaborator

tanersener commented Nov 3, 2021

We haven't tested the plugin in an app which uses fragments. It seems like something is wrong there. I'll approve the PR when it passes the PR checks. Thanks for reporting this.

@tanersener tanersener added bug Something isn't working flutter Affect flutter platform v4.5 Affects v4.5 release labels Nov 3, 2021
@tanersener tanersener added the fixed-on-development Fixed on the development branch. Not released yet. label Nov 3, 2021
@yanivshaked
Copy link
Contributor Author

Thanks. I will close this issue as soon as a new ffmpeg-kit version is released.

@tanersener tanersener added fixed-in-v4.5.1 and removed fixed-on-development Fixed on the development branch. Not released yet. labels Jan 3, 2022
@tanersener
Copy link
Collaborator

Fixed in v4.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed-in-v4.5.1 flutter Affect flutter platform v4.5 Affects v4.5 release
Projects
None yet
Development

No branches or pull requests

2 participants