I want to use Google's Mediapipe for a Kotlin JavaFX Desktop application. However, I am encountering a few roadblocks, which brings up a few questions.
I tried importing it, similar to the documentation. My build.gradle.kts looks similar to the following, but with "myMainClass" replaced with the name of my class. (I am fairly new with gradle and build systems, so it is mostly copy-paste and could be a dumb mistake):
#Imports
plugins {
java
application
kotlin("jvm") version "1.9.0"
id("com.github.gmazzo.buildconfig") version "3.0.0"
id("org.openjfx.javafxplugin") version "0.0.13"
}
val mainClass = "myMainClass"
buildConfig {
buildConfigField ("long", "BUILD_TIME", "${System.currentTimeMillis()}L")
}
repositories {
mavenCentral()
google()
jcenter()
maven { setUrl("https://plugins.gradle.org/m2/") }
}
javafx {
version = "19"
modules = "javafx.controls,javafx.fxml".split(",").toMutableList()
}
application {
mainClass = "myMainClass"
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.tensorflow:tensorflow-lite:2.5.0")
implementation("org.tensorflow:tensorflow-lite-gpu:2.5.0")
implementation("org.tensorflow:tensorflow-lite-support:0.1.0-rc1")
implementation("com.google.code.gson:gson:2.8.9")
implementation("com.google.mediapipe:tasks-vision:0.10.7")
}
java {
withSourcesJar()
withJavadocJar()
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
}
It builds sucessfully, but when I try to import Mediapipe, it gives me an 'Unresolved Refrence'
So, to answer my own questions: