question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WearOS: Application crashes on startup

See original GitHub issue

Home Assistant Android version: 2021.12.3

Android version: 10

Android Wear version: 2.35.0.325323493

Phone model: Huawei P20 Pro

Watch model: LG Watch Urbane

Home Assistant version: 2021.12.7

Last working Home Assistant release (if known): n/a

Description of problem: Android Wear application crashes on launch. Does not get past the splash screen.

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

2021-12-30 13:05:26.697 15075-15075/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.homeassistant.companion.android, PID: 15075
    java.lang.NumberFormatException: For input string: "public int android.view.ViewConfiguration.getScaledScrollFactor()"
        at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1306)
        at java.lang.Float.parseFloat(Float.java:459)
        at io.homeassistant.companion.android.util.RotaryEventDispatcherKt$scrollHandler$1.invoke(RotaryEventDispatcher.kt:29)
        at io.homeassistant.companion.android.util.RotaryEventDispatcherKt$scrollHandler$1.invoke(RotaryEventDispatcher.kt:21)

Full logs: ha-wearos-crash.log

Screenshot of problem: n/a

Additional information:

The Android Wear application was fully configured using the Home Assistant Android application on the phone because my installation uses MFA.

The Home Assistant installation is still in its infancy. Only one light is configured there.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vvelosocommented, Dec 31, 2021

The root cause is not about rotary bezels, feelings, or whether it is better or worse. It’s really a backward compatibility issue.

The vertical scrolling factor reading code, as it is written today, does not work with older Android/Wear versions because the Java reflection API is being used incorrectly. The mistake is easy to overlook but also easy to fix.

I’ll submit a PR next week.

Happy new year.

A sexta, 31 de dez de 2021, 17:20, Daniel Shokouhi @.***> escreveu:

One more thing @dshokouhi https://github.com/dshokouhi: I looked at #2092 https://github.com/home-assistant/android/pull/2092 and it looks like the call to invoke() on the Method instance returned by getDeclaredMethod() https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getDeclaredMethod-java.lang.String-java.lang.Class...- is missing. toString() is invoked directly on the Method instance, which will never produce the float value you’re looking for.

Take a look at the implementation of ViewConfigurationCompat https://android.googlesource.com/platform/frameworks/support/+/refs/heads/oreo-dev/compat/java/android/support/v4/view/ViewConfigurationCompat.java for an example.

Maybe it is a good idea to use ViewConfigurationCompat::getScaledVerticalScrollFactor https://developer.android.com/reference/androidx/core/view/ViewConfigurationCompat#getScaledVerticalScrollFactor(android.view.ViewConfiguration, android.content.Context) instead? 😉

Many people are using this current workaround while we wait for Google to add native rotary support. As of now this is just temporary and we are even using Google’s recommendation here. If you feel it’s better feel free to submit a PR, we are open source. For those of us with working bezels the code is working for us as is.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/android/issues/2090#issuecomment-1003411509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGCLQ4JNILAZSIQW5LPE6LUTXJ5LANCNFSM5K7UEPSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

1reaction
vvelosocommented, Dec 30, 2021

The watch does not have a working/rotary bezel if that’s what you mean. See: https://www.lg.com/us/smart-watches/lg-W150-lg-watch-urbane

Daniel Shokouhi @.***> escreveu no dia quinta, 30/12/2021 à(s) 20:21:

hmm does this watch have a bezel?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/android/issues/2090#issuecomment-1003153005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGCLQ2RFRR2WPBLNX2AFNLUTSWLJANCNFSM5K7UEPSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wear OS App denied for crash on startup - Multiple Activities
To fix this, simply remove the intent filters for all but one of your activities, leaving the one for whichever you want your...
Read more >
Wear OS app constantly crashing please help! - Reddit
Since today, The wear OS app is constantly crashing and my watch is not connected to my phone anymore.
Read more >
The Most Common Wear OS Problems and How to Fix Them
1. Start off by rebooting your watch and your smartphone and see if it makes a difference. Go to Settings > Restart on...
Read more >
Crashes - Android Developers
An app doesn't need to be running in the foreground for it to crash. Any app component, even components like broadcast receivers or...
Read more >
Pixel Watch app update crashing and complication editing ...
It's possible that a mismatch of Wear Core Series (the “Wear OS by Google Smartwatch” on your watch's Play Store), Google Play Services,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found