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

No implementation found for io.flutter.view.FlutterCallbackInformation #185

Closed
williambarreiro opened this issue Jan 14, 2021 · 22 comments
Closed
Labels
question Further information is requested

Comments

@williambarreiro
Copy link
Contributor

williambarreiro commented Jan 14, 2021

I am getting the following error, any suggestion?

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(FlutterCallbackInformation.java:30)
at rekab.app.background_locator.LocatorService.startLocatorService(LocatorService.kt:81)
at rekab.app.background_locator.LocatorService.onCreate(LocatorService.kt:69)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3380)
at android.app.ActivityThread.-wrap4()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1711)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6548)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)

@mehdok
Copy link
Collaborator

mehdok commented Jan 15, 2021

Hi @WilliamFB
Thank you for opening an issue;

Please share some code;

@williambarreiro
Copy link
Contributor Author

This is the LocatorService.kt of the version i am using, the error occurs on line 81.

Captura de tela de 2021-01-15 09-03-44

@mehdok
Copy link
Collaborator

mehdok commented Jan 15, 2021

Did you set the callback in the initialize function?

@williambarreiro
Copy link
Contributor Author

I think so, like this?

image

My version is at this point:
https://github.com/rekab-app/background_locator/tree/8190a64bbb4968c5ecdf41333234490360e9c12d

@mehdok
Copy link
Collaborator

mehdok commented Jan 15, 2021

You are pointing to the library source code, show the usage in your code.
something like this:

BackgroundLocator.registerLocationUpdate(LocationCallbackHandler.callback,

@williambarreiro
Copy link
Contributor Author

Is this happening because i am calling startLocator at the wrong moment? Obs: The crash only happens on a few devices.

image
image

@mehdok
Copy link
Collaborator

mehdok commented Jan 16, 2021

What do you mean by the wrong moment? Are you running the example app?

@mehdok mehdok added the question Further information is requested label Jan 21, 2021
@williambarreiro
Copy link
Contributor Author

Sorry @mehdok, i didn't want to say "wrong time", let's forget it. I will show some information below;

I am using bg_locator 1.2.2+1 and flutter 1.20.0;

My implementation is like the example, but there are some differences. I will show the differences after the implementation;

This is in my first screen initState:

image

image

The registerLocationUpdate:
image

Using the unRegisterLocationUpdate:
image

There are 2 differences:

  • I don't use these two lines in my callback, because i send my location to a queue and i don't need to send it to my main Isolate:
    final SendPort send = IsolateNameServer.lookupPortByName(_isolateName);
    send?.send(locationDto);

  • I am not calling the functions in a separate class, like:
    LocationCallbackHandler.callback or LocationCallbackHandler.initCallback
    I just call them directly, because they are in the same file, like i showed in registerLocationUpdate.

@mehdok
Copy link
Collaborator

mehdok commented Jan 22, 2021

I'm not sure if this is the problem, but we have to eliminate its possibility :)

Your callback function must be global or static, is it?
If yes, please put your callback in a separate file to see if it's working or not.

@williambarreiro
Copy link
Contributor Author

The callback is static, but anyway, i will separate the callback in a service. As soon as i know the results i tell you. Thanks!!

@mehdok
Copy link
Collaborator

mehdok commented Jan 22, 2021

While you are testing, it would be nice if you could test the example app to see if it's working for you or not, if the example app is working and your app doesn't, it would ease the debug process if you create a simple repository with your implementation;

@Johan07
Copy link

Johan07 commented Jan 25, 2021

Same issue

@bayuly94
Copy link

bayuly94 commented Feb 3, 2021

same issue

@qwert2603
Copy link

qwert2603 commented Feb 10, 2021

Adding FlutterInjector.instance().flutterLoader().ensureInitializationComplete(context, arrayOf()) has helped me.

@oligazar
Copy link

@mehdok
I have the same issue on line val callbackInfo = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle)

Registration for location updates, where _onLocationData is static:

await BackgroundLocator.registerLocationUpdate(_onLocationData,
        initCallback: _onInitBackgroundLocation,
        initDataCallback: data,
        disposeCallback: _onDispose,
...

Has anybody found the reason and solution or workaround?

@rueichang
Copy link

I got the same issue even the example app. This problem can be reproduced by rebooting the smart phone.
I had installed the example app first. Starting the service and ensure the service is running. Then I reboot the smart phone again and open the example app afterward. The APP will be crash and show the error message which is same as WilliamFB. And APP won't be able to start properly... My Android is 9.0..

@Trteich
Copy link

Trteich commented Aug 3, 2021

Any updates?
I've found that this crash appeares on app killing while service is running(not 100% reproducible). As I investigated, service tries to be recreated, and reffer to flutter part of app, but it is dead. Sorry for my confusing explanation, but since this happens when the application is killed, I have no way to debug.
Tried to return START_NON_STICKY from onStartComand(). It helpend on clean Android, but no effect on fu**ing Samsung. It seems like Samsung ignores START_NON_STICKY.

I'm completely not sure that my solution is right.

Also have an idea to cover all LocatorService.startLocatorService() into try/catch block, but it looks like a crutch

@Habil24
Copy link

Habil24 commented Jan 21, 2022

Same issue

@M-Ali-D
Copy link

M-Ali-D commented Apr 5, 2022

Adding FlutterInjector.instance().flutterLoader().ensureInitializationComplete(context, arrayOf()) has helped me.

It worked for me Thanks.

@Habil24
Copy link

Habil24 commented Apr 8, 2022

Adding FlutterInjector.instance().flutterLoader().ensureInitializationComplete(context, arrayOf()) has helped me.

Hi, where should we add this line in our app?

@mahira13
Copy link

Adding FlutterInjector.instance().flutterLoader().ensureInitializationComplete(context, arrayOf()) has helped me.

Hi, where should we add this line in our app?

did you find where to add this line?

@williambarreiro
Copy link
Contributor Author

I was using a very old version of the plugin, so i'm closing this issue. I recommend you take a look here: #340
Since the package is no longer being updated, they forked it and fixed some common problems...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests