```2023-11-10 11:47:59.224 java[34638:8397728] WAR...
# compose-desktop
m
Copy code
2023-11-10 11:47:59.224 java[34638:8397728] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'long org.jetbrains.skiko.MetalApiKt.chooseAdapter(int)'
Somebody knows where this error could come from?
I try to display this Composable in the MaterialTheme / Surface scope
Copy code
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen(
    cacheFile: File?
) {
    val properties = cacheFile?.let { propertyFile ->
        val properties = Properties()
        properties.load(propertyFile.inputStream())
        properties
    }

    val lastPath = properties?.get("lastPath")?.toString()

    var pickedPath by remember { mutableStateOf(lastPath) }
    var directoryPickerOpen by remember { mutableStateOf(false) }

    Column(
        modifier = Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        OutlinedTextField(
            modifier = Modifier.width(TextFieldDefaults.MinWidth * 3),
            value = pickedPath ?: "",
            onValueChange = { pickedPath = it },
            trailingIcon = {
                Icon(
                    imageVector = Icons.Default.Folder,
                    contentDescription = "Choose folder"
                )
            }
        )
    }


    DirectoryPicker(
        show = directoryPickerOpen,
        initialDirectory = pickedPath
    ) {
        pickedPath = it
        directoryPickerOpen = false
    }
}
a
The first error line is unrelated to the second
I’ve been getting it since upgrading to Sonoma
m
Okey, good to know. Just wanted to make shure everything needed is included
But where's the second error coming from?
You have a guess? @Alexander Maryanovsky
a
Somehow it can’t find the native implementation of MetalApi. How does your gradle file look like?
and what is
DirectoryPicker
?
m
It's an external lib
Copy code
dependencies {
    // Note, if you develop a library, you should use compose.desktop.common.
    // compose.desktop.currentOs should be used in launcher-sourceSet
    // (in a separate module for demo project and in testMain).
    // With compose.desktop.common you will also lose @Preview functionality
    implementation(compose.desktop.currentOs) {
        exclude("org.jetbrains.compose.material")
    }
    implementation(compose.material3)
    implementation(compose.materialIconsExtended)
    implementation("com.darkrockstudios:mpfilepicker:2.1.0") {
        exclude("org.jetbrains.compose.material")
    }
    implementation(project("api"))
}
a
I’d look into that library. Maybe it has a dependency on a different/incompatible skiko version.
Maybe you need to add an explicit dependency on skiko
m
could be possible
wait a second
Yeah, the library was causing that problem
Do you know any up to date File/Directory picker lib for composeß
a
Only the AWT/Swing one, but I’m sure there’s something out there that works.