Hello, I am getting this error in Compose Preview ...
# compose-android
l
Hello, I am getting this error in Compose Preview whenever I use
iterator()
on
Path
from `androidx.compose.ui.graphics`: This breaks the preview entirely…
Copy code
java.lang.UnsatisfiedLinkError: no androidx.graphics.path in java.library.path: /Users/Louis/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
I'm very confused as to why that is happening since everything else with
Path
works in Compose Preview. Am I the first one to see this? Is there a workaround? I'm on Android Studio Koala
2024.1.1 Patch 1
Stacktrace extract in the thread 🧵
Here's the stacktrace extract.
r
It won't work in previews, it's using a library with native code
😅 1
layoutlib would have to provide an implementation
l
Do you think it'd happen if I file an issue?
r
I doubt it'll be a high priority, it's a rather niche API
l
Compose Desktop is implementing it though?
That should help, right?
r
I don't see how?
l
layoutlib and Compose Desktop both target non-Android JVM, so I'm thinking the Compose Desktop implementation could be reused for layoutlib
r
The implementation is not the issue. Skia has support for this in newer versions
(and skiko has a bug that prevents/prevent this from working when I attempted to do the Compose Desktop implementation; I filed an issue a while back and I don't think it's been resolved yet)
l
Do you have the issue link?
Damn, I was hoping it would work with Robolectric, but even there, it doesn't, exactly the same issue…
r
It can't work with roboelectric either
There's no magic. It's a JNI library built for Android
It needs an implementation for the host
l
y
What's the shadow policy for robolectric? I thought that androidx libraries would need to support themselves, rather than any shadows in Robolectric?
l
Filed the Android Studio issue: https://issuetracker.google.com/issues/354621198
FYI, my use case is generating (animated) vector drawables programmatically. I actually want to use the
toSvg()
extension to integrate the path data in xml files. That's to create all the icons (adaptive, monochrome, and legacy), and the splashscreen animation.