home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.07k stars 587 forks source link

The application crashes on startup after the update 2024.3.5 #4323

Closed sascha93rus closed 1 month ago

sascha93rus commented 1 month ago

Home Assistant Android app version(s): 2024.3.5

Android version(s): 5.1.1

Device model(s): Samsung Galaxy Tab A6 (SM-T285)

Home Assistant version: 2024.4.1

Last working Home Assistant release (if known):

Description of problem, include YAML if issue is related to notifications: After updating the mobile app to version 2024.3.5 The application started crashing immediately after launch. There was no such problem before the update. I reinstalled the mobile application and now the application crashes after the screen of connecting the device to the Home Assistant (screenshot 1), but sometimes crashes before this screen.

Companion App Logs:

Screenshot or video of problem: Screenshot_2024-04-05-20-48-27 Screenshot_2024-04-05-20-25-56

Additional information:

dshokouhi commented 1 month ago

are you able to get us the logs from logcat by any chance? the easiest way is to use android studio and connect your phone to the logger

sascha93rus commented 1 month ago

I used Android Studio and Logcat. Error message: "FATAL EXCEPTION: main\nProcess: io.homeassistant.companion.android, PID: 15773\njava.lang.NoClassDefFoundError: com.fasterxml.jackson.databind.ObjectMapper\n\tat io.homeassistant.companion.android.common.data.HomeAssistantApis.\u003cinit\u003e(HomeAssistantApis.kt:74)\n\tat io.homeassistant.companion.android.DaggerHomeAssistantApplication_HiltComponents_SingletonC$SingletonCImpl.homeAssistantApis(DaggerHomeAssistantApplication_HiltComponents_SingletonC.java:1633)\n\tat io.homeassistant.companion.android.DaggerHomeAssistantApplication_HiltComponents_SingletonC$SingletonCImpl.-$$Nest$mhomeAssistantApis(DaggerHomeAssistantApplication_HiltComponents_SingletonC.java)\n\tat io.homeassistant.companion.android.DaggerHomeAssistantApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get(DaggerHomeAssistantApplication_HiltComponents_SingletonC.java:1935)\n\tat dagger.internal.DoubleCheck.get(DoubleCheck.java:47)\n\tat io.homeassistant.companion.android.DaggerHomeAssistantApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider$1.create(DaggerHomeAssistantApplication_HiltComponents_SingletonC.java:1930)\n\tat io.homeassistant.companion.android.common.data.servers.ServerManagerImpl.authenticationRepository(ServerManagerImpl.kt:174)\n\tat io.homeassistant.companion.android.launch.LaunchActivity.registerAndOpenWebview(LaunchActivity.kt:182)\n\tat io.homeassistant.companion.android.launch.LaunchActivity.access$registerAndOpenWebview(LaunchActivity.kt:45)\n\tat io.homeassistant.companion.android.launch.LaunchActivity$onOnboardingComplete$1.invokeSuspend(LaunchActivity.kt:146)\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)\n\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)\n\tat android.os.Handler.handleCallback(Handler.java:739)\n\tat android.os.Handler.dispatchMessage(Handler.java:95)\n\tat android.os.Looper.loop(Looper.java:145)\n\tat android.app.ActivityThread.main(ActivityThread.java:6939)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java:372)\n\tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)\n\tSuppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@1ba89e8b, Dispatchers.Main]". Снимок экрана 2024-04-05 222442

If necessary, I can attach a full Logcat.

jpelgrom commented 1 month ago

Also reproduced this on the emulator.

It looks like the latest Retrofit update is causing our Jackson version to be at 2.17, while we have intentionally kept it lower because this increases the minimum SDK requirement (#3518).

https://github.com/square/retrofit/blob/trunk/retrofit-converters/jackson/build.gradle#L6 -> 2.9.0: https://github.com/square/retrofit/blob/2.9.0/build.gradle#L29 2.10.0: https://github.com/square/retrofit/blob/2.10.0/gradle/libs.versions.toml#L71 -> https://github.com/square/retrofit/blob/2.10.0/gradle/libs.versions.toml#L23

The app uses 2.13.5:

https://github.com/home-assistant/android/blob/973b50d4c74af048bf6eaad1d406c38e23a9f258/gradle/libs.versions.toml#L34

Gradle prefers the highest version:

Gradle will consider all requested versions, wherever they appear in the dependency graph. Out of these versions, it will select the highest one.