You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a toy android app for which I implement as much functionality as I can in Rust, with a Kotlin UI on the top. I use the rust-android-gradle plugin to make the build work in Android Studio, which has been relatively smooth sailing for several years now.
I am not at all a gradle expert, so I had to fight a bit (with the help of ChatGPT 😬) to get some configuration for rust-android-gradle to feed the right environment for duchess.
I thought I'd share it here in case anyone has better ideas on how to integrate a project using duchess into an android app, and also in case anyone else is trying this sort of thing. Also feel free to treat this just as informational and close the issue 😄
cargo {
module ="../../client-lib"
libname ="toyproject"
targets = ["arm64"]
targetDirectory ="../../target"
exec { spec, toolchain->// Classpath of the android SDKdef classPath ="${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"// Classpath of the build outputs
android.applicationVariants.all { variant->
variant.outputs.each { output->// Java outputs (if you have any java files)
classPath +=";${variant.javaCompileProvider.get().destinationDir}"// Kotlin outputs (if you have any kotlin files)def kotlinTaskName ="compile${variant.name.capitalize()}Kotlin"def kotlinTask = tasks.named(kotlinTaskName).get()
if (kotlinTask) {
classPath +=";${kotlinTask.outputs.files.join(";")}"
}
}
}
spec.environment("CLASSPATH", classPath)
// Set JAVA_HOME so that duchess can find javap
spec.environment("JAVA_HOME", System.getProperty('java.home'))
}
}
The text was updated successfully, but these errors were encountered:
I have a toy android app for which I implement as much functionality as I can in Rust, with a Kotlin UI on the top. I use the
rust-android-gradle
plugin to make the build work in Android Studio, which has been relatively smooth sailing for several years now.I am not at all a gradle expert, so I had to fight a bit (with the help of ChatGPT 😬) to get some configuration for
rust-android-gradle
to feed the right environment forduchess
.I thought I'd share it here in case anyone has better ideas on how to integrate a project using duchess into an android app, and also in case anyone else is trying this sort of thing. Also feel free to treat this just as informational and close the issue 😄
The text was updated successfully, but these errors were encountered: