Repository navigation
Description
Java and Kotlin bindings seem to work well on a standard JVM, but I haven't been able to get them working on Android without modifying the Clojure runtime.
Before going any further, I'd like to ask: Is Android support something YAMLStar would be interested in supporting?
I've explored two possible approaches and wanted to share my findings.
1. Making the Clojure runtime work on Android
The first issue I encountered was this kind of error:
clojure.lang.ExceptionInfo: Unknown YAML parser plugin: reference. Available: none {:parser "reference", :available ()}
But such problems can be addressed by extending AOT compilation https://github.com/yaml/yamlstar/blob/v0.1.25/java/project.clj#L30 and including additional namespaces such as yamlstar.plugin.parser.reference and some others.
However, a more fundamental issue is the following crash:
E FATAL EXCEPTION: main
Process: com.celecavac.yamlstar2, PID: 20282
java.lang.ExceptionInInitializerError
at yaml_parser.parser$chars_rep$chars_rep_fn__1091.invoke(parser.cljc:1255)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
...
Caused by: java.lang.NoSuchMethodException: canAccess [class java.lang.Object]
at java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:991)
at clojure.lang.Reflector.<clinit>(Reflector.java:39)
I was able to get it running by replicating xlisp/clojure-android@620f584 and using a locally built Clojure JAR. It's not a very nice approach and without having something like this in Clojure upstream, it might be a no go.
I haven't tested it extensively, and there may be other compatibility issues.
2. Native Compilation
Another approach would be to compile this to native code for Android's 4 main ABIs and provide a small JNI layer.
The downside is that Android would need another set of Kotlin (and/or Java) bindings, e.g. yamlstar/kotlin-android. The generated AAR would be somewhat larger due to 4x native libraries, but on the upside, there would be no transitive dependencies.
I experimented with this a bit on ARM64 Android device, and it seemed to work fine.
If native Android support is of interest, I could share more info about the build setup. It produces the following AAR
$ ls -lh kotlin-yamlstar-android-0.1.24.aar
-rw-rw-r-- 1 cecavac cecavac 24M Oct 17 12:55 kotlin-yamlstar-android-0.1.24.aar
After unpacking it, the native library sizes are:
| ABI | libyamlstar.so | libyamlstar-jni.so |
|---|---|---|
| arm64-v8a | 17 MB | 9.2 KB |
| armeabi-v7a | 19 MB | 7.6 KB |
| x86 | 19 MB | 7 KB |
| x86_64 | 19 MB | 8.2 KB |
Activity
ingydotnet commentedon Oct 20, 2026
YAMLScript and YAMLStar are very similar and share a lot of their code.
FYI, you can use YAMLScript exactly like YAMLStar. Without using
!-ystags it works the same, but YAMLStar has the new promising plugin system.YAMLStar started as a reduced codebase of YAMLScript.
They both are written in Clojure.
They used to be compiled to binaries
yamlandlibyamlstar.sousing GraalVM native-image compiler.Now they use Glojure (same Clojure source code) to compile to Go code which compiles to those binaries and for many more platforms.
There are 32 language bindings:
I'd like to see YSs get to as many places as possible. I don't know much about Android programming yet, but I do have YAMLScript programs running as Wasm on andriod and ios. See https://gloathub.org/ and https://yamlschema.org/
YAMLStar and YAMLScript have wasm-p1 releases. One thing I can easily do is release them as browser wasm binaries.
The internet told me that "Yes, Go code can be compiled to run natively on Android".
I just checked and there's an android channel on the clojurians slack https://clojurians.slack.com/archives/C07JPKQ5S/p1779722437051339
The last message is:
To finally answer your question "Before going any further, I'd like to ask: Is Android support something YAMLStar would be interested in supporting?"...
Yes, sure!