nightscout / AndroidAPS

Opensource automated insulin delivery system (closed loop)
https://wiki.aaps.app
GNU Affero General Public License v3.0
725 stars 1.76k forks source link

[V3 Beta 11] Wear OS devices SDK < 25 are no longer working #1122

Closed Andries-Smit closed 2 years ago

Andries-Smit commented 2 years ago

Dear team,

Older Wear OS devices SDK < 25 are no longer working. This is issue occurred after commit https://github.com/nightscout/AndroidAPS/commit/17b4d6e7ed14a0f602678251ee7d8ace162f06fe. The commit introduced decency injection for Wear OS.

And on start up cause the following Error

2021-12-16 20:08:32.947 3293-3293/info.nightscout.androidaps W/System: ClassLoader referenced unknown path: /data/app/info.nightscout.androidaps-1/lib/x86 2021-12-16 20:08:32.951 1313-1388/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x933 imply creation of host color buffer 2021-12-16 20:08:32.957 3293-3293/info.nightscout.androidaps D/AndroidRuntime: Shutting down VM

--------- beginning of crash

2021-12-16 20:08:32.957 3293-3293/info.nightscout.androidaps E/AndroidRuntime: FATAL EXCEPTION: main Process: info.nightscout.androidaps, PID: 3293 java.lang.NoClassDefFoundError: Failed resolution of: Landroid/net/wifi/hotspot2/pps/HomeSp; at info.nightscout.androidaps.di.DaggerAppComponent.mapOfClassOfAndProviderOfAndroidInjectorFactoryOf(DaggerAppComponent.java:119) at info.nightscout.androidaps.di.DaggerAppComponent.dispatchingAndroidInjectorOfObject(DaggerAppComponent.java:123) at info.nightscout.androidaps.di.DaggerAppComponent.injectAaps(DaggerAppComponent.java:232) at info.nightscout.androidaps.di.DaggerAppComponent.inject(DaggerAppComponent.java:228) at info.nightscout.androidaps.di.DaggerAppComponent.inject(DaggerAppComponent.java:51) at dagger.android.DaggerApplication.injectIfNecessary(DaggerApplication.java:63) at dagger.android.DaggerApplication.onCreate(DaggerApplication.java:38) at info.nightscout.androidaps.Aaps.onCreate(Aaps.kt:15) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.net.wifi.hotspot2.pps.HomeSp" on path: DexPathList[[zip file "/system/framework/com.google.android.wearable.jar", zip file "/data/app/info.nightscout.androidaps-1/base.apk"],nativeLibraryDirectories=[/data/app/info.nightscout.androidaps-1/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at info.nightscout.androidaps.di.DaggerAppComponent.mapOfClassOfAndProviderOfAndroidInjectorFactoryOf(DaggerAppComponent.java:119) at info.nightscout.androidaps.di.DaggerAppComponent.dispatchingAndroidInjectorOfObject(DaggerAppComponent.java:123) at info.nightscout.androidaps.di.DaggerAppComponent.injectAaps(DaggerAppComponent.java:232) at info.nightscout.androidaps.di.DaggerAppComponent.inject(DaggerAppComponent.java:228) at info.nightscout.androidaps.di.DaggerAppComponent.inject(DaggerAppComponent.java:51) at dagger.android.DaggerApplication.injectIfNecessary(DaggerApplication.java:63) at dagger.android.DaggerApplication.onCreate(DaggerApplication.java:38) at info.nightscout.androidaps.Aaps.onCreate(Aaps.kt:15) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 2021-12-16 20:08:32.958 1613-1933/system_process W/ActivityManager: Force finishing activity info.nightscout.androidaps/.interaction.menus.MainMenuActivity

The injector tries to add android/net/wifi/hotspot2/pps/HomeSp, however there seems no reference to the class in our code. HomeSP is introduced in SDK 26. See also https://wearenotwaiting-dev.slack.com/archives/CAWP5KBS8/p1639684445042600

We do not have any firebase statistics to see the impact on changing the minimum SDK. Therefore I opened a poll to see device usage https://www.facebook.com/groups/AndroidAPSUsers/permalink/3170385673182828

Andries-Smit commented 2 years ago

Fixed in pr #1127