Use JavaFX Gradle plugin for proper module path setup
Replace manual classifier-based jar deps with the openjfx javafx-plugin which correctly sets up the JavaFX module path, native lib paths, and JVM args needed for media codecs (AVFoundation on macOS). This fixes 'media type not supported' which was caused by JavaFX being on classpath instead of module path — native .dylib codecs only load when JavaFX runs as a named module.
This commit is contained in:
@@ -4,6 +4,7 @@ plugins {
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
alias(libs.plugins.compose.multiplatform)
|
||||
alias(libs.plugins.javafx)
|
||||
}
|
||||
|
||||
group = "com.bolenpad.photophetch"
|
||||
@@ -32,21 +33,12 @@ dependencies {
|
||||
implementation(libs.slf4j.api)
|
||||
implementation(libs.logback.classic)
|
||||
|
||||
// JavaFX media for Live Photo video playback in preview dialog
|
||||
val javafxVersion = "21.0.3"
|
||||
// Detect platform: mac-aarch64 for Apple Silicon, mac for Intel
|
||||
val osArch = System.getProperty("os.arch") ?: "x86_64"
|
||||
val javafxPlatform = when {
|
||||
System.getProperty("os.name").contains("Mac", ignoreCase = true) && osArch.contains("aarch64") -> "mac-aarch64"
|
||||
System.getProperty("os.name").contains("Mac", ignoreCase = true) -> "mac"
|
||||
System.getProperty("os.name").contains("Win", ignoreCase = true) -> "win"
|
||||
else -> "linux"
|
||||
}
|
||||
implementation("org.openjfx:javafx-media:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-swing:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-graphics:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-base:$javafxVersion:$javafxPlatform")
|
||||
implementation("org.openjfx:javafx-controls:$javafxVersion:$javafxPlatform")
|
||||
// JavaFX media — configured via the javafx plugin block below
|
||||
}
|
||||
|
||||
javafx {
|
||||
version = "21.0.3"
|
||||
modules = listOf("javafx.media", "javafx.swing", "javafx.graphics", "javafx.controls", "javafx.base")
|
||||
}
|
||||
|
||||
compose.desktop {
|
||||
|
||||
Reference in New Issue
Block a user