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

java.lang.UnsatisfiedLinkError in ActionBroadcastReceiver #1750

Closed
noinskit opened this issue Oct 11, 2022 · 13 comments
Closed

java.lang.UnsatisfiedLinkError in ActionBroadcastReceiver #1750

noinskit opened this issue Oct 11, 2022 · 13 comments

Comments

@noinskit
Copy link
Contributor

Describe the bug

I got a production crash report in ActionBroadcastReceiver with the following stack trace:

Fatal Exception: java.lang.UnsatisfiedLinkError: No implementation found for io.flutter.view.FlutterCallbackInformation io.flutter.embedding.engine.FlutterJNI.nativeLookupCallbackInformation(long) (tried Java_io_flutter_embedding_engine_FlutterJNI_nativeLookupCallbackInformation and Java_io_flutter_embedding_engine_FlutterJNI_nativeLookupCallbackInformation__J)
       at io.flutter.embedding.engine.FlutterJNI.nativeLookupCallbackInformation(FlutterJNI.java)
       at io.flutter.view.FlutterCallbackInformation.lookupCallbackInformation()
       at com.dexterous.flutterlocalnotifications.isolate.IsolatePreferences.lookupDispatcherHandle(:8)
       at com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver.startEngine(ActionBroadcastReceiver.java:3)
       at com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver.onReceive(ActionBroadcastReceiver.java:10)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3996)
       at android.app.ActivityThread.access$2300(ActivityThread.java:273)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2050)
       at android.os.Handler.dispatchMessage(Handler.java:112)
       at android.os.Looper.loop(Looper.java:216)
       at android.app.ActivityThread.main(ActivityThread.java:7625)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

The function I'm passing to onDidReceiveBackgroundNotificationResponse is annotated with @pragma("vm:entry-point") (but I think the problem is happening earlier).

Plugin version 12.0.1+1, Flutter 3.3.4.

To Reproduce

I don't know how to reproduce it myself, in my tests and for most production users it's all good.

@noinskit
Copy link
Contributor Author

Looks like this tends to pop up in other plugins that run background isolates as well, but I don't see a definitive fix/explanation anywhere...

background_locator: rekabhq/background_locator#185 - apparently people are adding FlutterInjector.instance().flutterLoader().ensureInitializationComplete() somewhere to help (?)

android_alarm_manager: flutter/plugins@de56da5 - changed to create FlutterEngine instance before callback lookup (?)

@MaikuB
Copy link
Owner

MaikuB commented Oct 11, 2022

@noinskit how quick/easy would it be for you to validate a solution? Asking as if it's quick/easy, are you able to pin the app to 12.0.0 to see if it solves the issue? In 12.0.1 I tried to validate the existence of the callback before the engine was initialised. Should also be easy to update the plugin code and should be a harmless change AFAIK since it would be similar to what the android_alarm_manager plugin is doing

@noinskit
Copy link
Contributor Author

I can update or pin FLNP versions quite quickly, but it's hard to be sure, because I can't reproduce this locally and so far I have just one production user that triggered this (so even if it doesn't happen for a few days, it doesn't mean that it's fixed).

@MaikuB
Copy link
Owner

MaikuB commented Oct 11, 2022

If I'm understanding the fix for the android_alarm_manager correctly though, it's more to do with how it was unable to find a callback as opposed to crashing so suspect this is a different issue. Nevertheless, this change could be done ASAP in the plugin though oddly I didn't run into the issue when retesting to ensure actions worked

@noinskit
Copy link
Contributor Author

It must be non-deterministic or depend on some factors like phone model. I just tried two scenarios with my app on my phone - clicking on an action with app in foreground and clicking on an action after reboot, without the app running... and everything worked correctly.

@MaikuB
Copy link
Owner

MaikuB commented Oct 11, 2022

Afraid I don't have ideas on this one and support for actions came via a PR that a number of others in the community seemed to had been using for a while. The plugin already calls FlutterInjector.instance().flutterLoader().ensureInitializationComplete() at

. Coincidentally, I was wondering if it was necessary in hindsight as android_alarm_manager doesn't have it though suspect there's no harm in keeping it there

@noinskit
Copy link
Contributor Author

Right... although the call to loader.ensureInitializationComplete() (line 84) is after lookupCallbackInformation() that threw the exception (line 74). But I don't see why it would be necessary either.

@MaikuB
Copy link
Owner

MaikuB commented Oct 11, 2022

Uploaded 12.0.2. Not sure if it'll fix the issue you're experiencing though

@noinskit
Copy link
Contributor Author

Thanks. I understand. I'll upgrade to 12.0.2 and report back if it reoccurs (hopefully with more data if it does).

@noinskit
Copy link
Contributor Author

I'm optimistic... I've got 4 crashes of this kind total (on 3 different phone models and 2 Android versions), all still on 12.0.1+1.

@MaikuB
Copy link
Owner

MaikuB commented Dec 3, 2022

@noinskit did you gety around to upgrading the plugin version used in your app and if so any updates on this?

@noinskit
Copy link
Contributor Author

noinskit commented Dec 3, 2022

I think it's fixed! I upgraded around October 11th and I didn't have any crashes of this kind since then.

@MaikuB
Copy link
Owner

MaikuB commented Dec 3, 2022

Thanks for update. Will close this then 🙂

@MaikuB MaikuB closed this as completed Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants