Open garrison-henkle opened 2 weeks ago
Thanks!
@terrakok, it is reproduced on the provided project. sharedUserId
is deprecated, but it isn't possible to migrate old projects that needs to be maintained. Can we use the suggested fix?
The classloader logic was implemented by intention here: https://github.com/JetBrains/compose-multiplatform/pull/2490
I will investigate it more because it seems suspicious
Describe the bug Compose Resources fails to load resources on Android when the application is using a
sharedUserId
Affected platforms
Versions
To Reproduce Minimal reproducer using
kmp.jetbrains.com
's Android template: https://github.com/garrison-henkle/composeResourcesSharedUserIdBugStacktrace is also in the above repo's
README.md
Steps:
sharedUserId
attribute in theManifest.xml
.Expected behavior The app is able to load resources regardless of whether it uses a
sharedUserId
or notScreenshots N/A
Additional context I maintain an application that has unfortunately inherited a
sharedUserId
. My team has been building out a replacement app using Compose Mutliplatform, and we recently added in thesharedUserId
to prepare it for submission to the Play Store. The addition of thesharedUserId
prevents the app from loading any images or strings (fonts load fine because the underlying implementation delegates to Android's asset loader).I investigated the issue and narrowed it down to the class loader. Removing
Thread.currentThread().contextClassLoader
from ResourceReader.android.kt seemed to fix the issue for me:I know essentially nothing about class loaders, so I don't know the implications of just removing the
Thread
's context class loader here. Hopefully the above hack at least demonstrates what's causing the issue đŸ˜…