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

Getting Run Time Exception on Android 11 #66

Open
Niranjan-10 opened this issue Jan 24, 2022 · 11 comments
Open

Getting Run Time Exception on Android 11 #66

Niranjan-10 opened this issue Jan 24, 2022 · 11 comments
Labels
Android Android Home Screen Widgets

Comments

@Niranjan-10
Copy link

Fatal Exception: java.lang.RuntimeException: Unable to create service es.antonborri.home_widget.HomeWidgetBackgroundService: java.lang.NullPointerException: Attempt to read from field 'java.lang.String io.flutter.view.FlutterCallbackInformation.callbackLibraryPath' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4673)
at android.app.ActivityThread.access$1700(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2196)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

@ABausG ABausG added the Android Android Home Screen Widgets label Jan 24, 2022
@ABausG
Copy link
Owner

ABausG commented Jan 24, 2022

Could you provide some more information when/how this is happening?

@Niranjan-10
Copy link
Author

Yeah when app in background user tap on widget it's happening.

@Niranjan-10
Copy link
Author

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19044.1466], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.63.2)
[√] Connected device (3 available)

• No issues found!

@Niranjan-10
Copy link
Author

Niranjan-10 commented Jan 24, 2022

home_widget: ^0.1.3

Platform: Android
OS version: 11.0

@ABausG
Copy link
Owner

ABausG commented Jun 5, 2022

Is this possible a similar issue as #74 ? If so I would expect that the error message is now different to what you had in the your original issue?

@chriselster
Copy link

I'm encountering a similar crash that was reported on Stack Overflow two days ago (link: https://stackoverflow.com/questions/76040745/homewidgetbackgroundservice-error-using-es-antonborri). It appears to be a recurring issue. Upon further investigation, it seems that the problem may be related to FlutterCallbackInformation.lookupCallbackInformation(callbackHandle) returning null. As a workaround, I am currently using the following solution
image
However, I have noticed that when the crash occurs, the widget becomes unresponsive to touch interactions.

@ABausG
Copy link
Owner

ABausG commented Jun 30, 2023

Is this still an issue?

@harithNasahruddin
Copy link

Im currently having this issue and are not able to fix the problem that is causing the crash. Check my implementation with the documentation I think I have implemented it correctly.

@firstmetcs
Copy link

Still appears, it seems the exception is due to the call of HomeWidgetBackgroundIntent.getBroadcast, when I clicked the title of the example, the flutter app crashes, in the HomeWidgetExampleProvider class, the following code deals with the click action of the title section.

                val backgroundIntent = HomeWidgetBackgroundIntent.getBroadcast(
                        context,
                        Uri.parse("homeWidgetExample://titleClicked")
                )
                setOnClickPendingIntent(R.id.widget_title, backgroundIntent)

/cc @ABausG

@ABausG
Copy link
Owner

ABausG commented Sep 28, 2023

@firstmetcs what version of home_widget are you on and which Android Version does this appear with?

i recently build a new example for interactivity using 0.4.0-alpha.0 and did not see any issues with that.
https://medium.com/@ABausG/interactive-homescreen-widgets-with-flutter-using-home-widget-83cb0706a417

@eliasto
Copy link
Contributor

eliasto commented Oct 16, 2023

Hi! I'm making a contribution about this error.
It seems the crash is encountered when the app is not running in the background. Therefore, the widget cannot communicate with the dart code, so the crash. I don't know if there is a way to force the opening of the app in the background ? Because, for example, when the user update the app on the Google Play Store, and add the widget on the home screen, without opening the app first, the crash will occur.
Nevertheless, this crash won't happen if the app was opened, before the installation of the widget.
Here, some crashlytics logs from a random device.
Thank you for your help. :)
Crashlytics_home_widget.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android Home Screen Widgets
Projects
None yet
Development

No branches or pull requests

6 participants