Clojure and Android
summary
Achieves true dynamic compilation on Android by converting emitted JVM class files to DEX in memory using code pulled from dx.jar, packaging a tiny APK and loading it via the Android runtime; the approach works on >97% of devices but some macros can blow the stack and Java-only APIs like java.beans and clojure.repl are unavailable. Runtime costs: Clojure shrinks a 3MB JAR to ~1MB DEX, adds ~1.2MB to heap and increases cold startup to ~2.3s vs 0.4s for Java/Scala; tooling (Neko, REPL-on-device, Lein plugins) is prototype-level.
AI-written summary · about
chapters (33)
- 0:00Intro
- 1:30Overview
- 1:58What is Android?
- 2:13Android architecture
- 2:52The good news
- 3:13Java VM vs. Dalvik VM
- 4:06A class file
- 4:32An application
- 4:51Creating a DEX
- 5:31An Android application
- 6:13Consequences
- 7:07Dynamic compilation on Android
- 9:16What about Android?
- 9:28A new class loader
- 10:02The Dalvik process
- 11:07New dependency
- 11:35Android compatibility
- 11:52Clojure compatibility
- 12:52Benchmarking Clojure and the competition
- 13:14Package size (MB)
- 13:39Installed size (MB)
- 13:56Startup time (s)
- 14:57Heap size (MB)
- 16:54Measuring time, a test
- 19:34Improving performance
- 20:43Making Clojure a first-class language for Android development
- 21:44Android development version of Clojure
- 22:14Build tools
- 22:42REPL/dynamic development tools
- 23:20What about ClojureScript?
- 24:52Android and Clojure
- 26:14Decaffeinated Android
- 26:42Questions?
related talks
40mClojure on Android
28mBest practices using compilers in Android Studio
55mCompilers. Dalvik. ART. And everything in between
35mUnderstanding the Kotlin to Dalvik bytecode translation
39mWhat's new in Android Runtime
41mDigging into D8 and R8
30mHow Clojure Works: Understanding the Clojure Runtime
01h 00mStatic Java, GraalVM Native and OpenJDK
