android: Crash when poor or no connection with widgets
Home Assistant Android version: 2022.3.0-full
Android version: 12
Phone model: Pixel 5
Home Assistant version: 2022.3.8
Last working Home Assistant release (if known): ??
Description of problem: I have several widgets. One of them to display an entity and 22 service calls. Quite a few times, when I loose connection with the HA or recover it (when I have poor coverage, in the garage, when toggling back from Airplane Mode to normal mode …), I have one or several crashes.
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):
Screenshot of problem:

Additional information:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (12 by maintainers)
I agree, and the PR mentioned in my previous comment + the linked PR should prevent two crashes you were experiencing and makes it possible to recover from them.
Please open a new issue for this with more details so we can look into it. Possibly a duplicate of #2604?
I’ve done this. And so far, so good.
However, I assume that despite “fixing the DB” from the app, it should treat the crashes more gracefully and be transparent to the user, with no visible crash.
Furthermore, the “edition” of a widget is not working correctly, both for “entity states” and “service buttons” are broken when editing.
Thanks for all the additional logs!
Your first log after changing the internal/external URL shows a crash due to not being able to make a connection which is unexpected because there should be no widgets that connect to the network on screen on/off.
However, the second and third logs + your description suggests that there is some old/corrupt data in the database which might be causing the crashes. It could be that during restore the app’s data was restored but the widgets weren’t, which results in the app thinking there are certain widgets when they don’t exist.
Unfortunately this can’t really be resolved right now except for starting fresh: https://companion.home-assistant.io/docs/troubleshooting/faqs#starting-fresh-with-the-android-app. You will have to set up your widgets again. Please try this and let us know if there are still background crashes.
Crash after changing internal/external address
Crash in settings > Manage Widgets
StaticWidget: Unable to fetch entitywhich shouldn’t be possible if all entity widgets were removed, which suggests old widgets in the database from before a restore. This will then be used on screen on/off, so #2615 might potentially fix the background crash.Logcat Reader is usually recommended and should work. Try to use it after the app has recently crashed, if it’s been several hours the logs might not include the error anymore.