State of Clojure on Android

I’ve seen that Neko is archived, and there is generally hardly any information on using native Clojure on Android. Rather, everyone seems to move to Clojurescript with re-agent or the likes. This looks strange to me, since Android basically is Java, and Clojure could profit from it. Can anyone explain why this opportunity is not used? Or maybe I just don’t understand Android development. I have no experience whatsover, but I do now that Android Studio willingly offers you to create a new project in Java or Kotlin. So I have the naive feeling that it should not be too difficult to add Clojure to the mix. Is it?

1 Like

My understanding is that application startup with Clojure is what kills its use for Android, since that startup overhead is amplified dramatically on Android.

I don’t know if things have changed in the last few years, but searching for Clojure on Android turns up comments about the differences between Java/JVM and the Android bytecode system all working against the way Clojure and GraalVM etc have evolved… so “Android is basically is Java” isn’t really true.

So my premise is wrong, it is not all Java. Thats interesting. Still a miss…

I’m not familiar with the Java situation on Android, but for what it’s worth the ClojureDart dialect is growing fast as a way to reach Android devices (as well as iOS and desktop).

1 Like

I spent some time finding out what the situation is. What I found out was that Android versions of Clojure still had performance problems. The way how Clojure is heavily dependent on the Garbage Collector made it very slow on Android.

I found a few people saying, that Android is not really Java. It is just the programming language. With Dalvik Android used a Just in Time compilation, which was already incompatible with the JVM. And since version 5.0 Android uses the “Android Runtime”, which follows more the Ahead of Time idea. Things are compiled at installation time of apps and the security mechanisms prevent any dynamic behaviour. All the effort getting Clojure on Android was then in vane.

This is how I speculate the situation. I did not even find discussion in the Internet, so I cannot tell you if my speculation is correct. But it looks like there is really no hope for a native Clojure on Android. A complete reimplementation as an interpreted language (the Babashka approach) or a strongly tailored version of Clojure (so that it is no longer a dynamic language) seems to be more promissing than the JVM Clojure. But I would not expect that this happens, because even in the Android community people seem to prefer React Native or Flutter.

Thanks a lot for these detailed and researched answers y’all!

This isn’t about Clojure on Android, but about Clojure for mobile apps:

If you are making a mobile app and want to write in Clojure(script), then shadow-cljs + Expo works very well in my experience. Your code is all CLJS and you get both an iOS app and an Android app.