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

[health: 11.0.0] Crashes with lateinit property healthConnectClient has not been initialized #1043

Closed
hagen00 opened this issue Sep 13, 2024 · 3 comments · Fixed by #1048
Closed
Assignees
Labels
bugfix a bug fix

Comments

@hagen00
Copy link

hagen00 commented Sep 13, 2024

This is to reopen this issue: #1032

My comment there is:
I recently upgraded from 9 to 11 and now it crashes on my emulator, API 33 as well with the same error:
E/AndroidRuntime(21677): kotlin.UninitializedPropertyAccessException: lateinit property healthConnectClient has not been initialized

Surely this needs fixing? If Health Connect not installed it shouldn't crash the entire app? I'm not sure at this stage if this will happen in production as well, but my most recent update to Huawei was rejected due to a crash and it may be related to this. The update to Google Play is not live yet; I'm hoping that the app doesn't crash on production, if a user doesn't have Health Connect installed.

Seems like a P1 issue to me?


I'm reverting back to using Health 9.0.1. It's been stable and seemingly working well. Things working fine on emulator again and I suspect this will fix the Huawei crash as well.

@hagen00 hagen00 added the bugfix a bug fix label Sep 13, 2024
@SlimShadyIAm
Copy link
Contributor

We will implement a fix for this ASAP.

@SlimShadyIAm
Copy link
Contributor

Could you please test my draft PR in #1048 to see if it resolves the issue? If so, I will release it after updating the documentation to say we throw an exception in this situation.

@hagen00
Copy link
Author

hagen00 commented Sep 20, 2024

With Health 9.0.1, I am able to do the following:

  • Have the same code run on Huawei or Emulator, where HC is not available, without a crash
  • If the user doesn't have HC installed or HC is not available on the device, nothing crashes and no error is thrown.

I'm not sure that throwing an error and "forcing" the user to install HC is the solution. Flutter code will run on devices such as Huawei, where installing HC is not possible. Also, for some apps, having HC integration is not vital, i.e it's totally fine if the user does not install HC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix a bug fix
Projects
None yet
2 participants