Hi :slightly_smiling_face: I have been playing wit...
# ktor
v
Hi 🙂 I have been playing with Kotlin/Native for Android (building final executable binaries that run on Android devices) and I was wondering if there is a way to use ktor server for androidNativeArm64. I tried to use
ktor-server-cio
but I run into dependency resolution error (I guess Ktor server CIO does not support android native as presented in the Supported platforms documentation). I found this related question with an answer mentioning a "partial support" but I suspect that "native/android" was referring to "native targets and/or android (jvm) target", not "android native target". Does someone managed to make
ktor-server
work from android native binary and/or have some pointers I could look at? 🙏
solved 1
b
v
Great news, thanks a lot for the information and the link 🙏
Follow-up - in case someone might be interested in running ktor on android native - • the initial support for android native targets by whyoleg worked like a charm (at least for my use case) • I have just modified the publication script to publish androidNativeXXX artifacts
Copy code
diff --git a/buildSrc/src/main/kotlin/Publication.kt b/buildSrc/src/main/kotlin/Publication.kt
index 1b62c68b0..6d02ae1f9 100644
--- a/buildSrc/src/main/kotlin/Publication.kt
+++ b/buildSrc/src/main/kotlin/Publication.kt
@@ -47,6 +47,15 @@ fun isAvailableForPublication(publication: Publication): Boolean {
         "macosArm64"
     )
 
+    val androidPublication = setOf(
+        "androidNativeArm32",
+        "androidNativeArm64",
+        "androidNativeX64",
+        "androidNativeX86"
+    )
+
+    result = result || name in androidPublication
+
     result = result || (HOST_NAME == "macos" && name in macPublications)
 
     return result
• Running
./gradlew publishToMavenLocal
to publish artifacts locally make it possible to depends on
io.ktor:ktor-server-cio
and
io.ktor:ktor-server-server
from android native source sets. • Pushing the final binary on an Android Emulator and starting the server worked perfectly (at least for a simple "Hello World" exemple) • Forwarding ports with adb made it even possible to reach the web server running on the android emulator from a browser running on the host machine ! 🎉 Thanks again @Bruce Hamilton for pointing me in the right direction! Made my day :)
🙏 1