A sample Android app built with Clojure, demonstrating AOT compilation, the neko UI DSL, and REPL-driven development via nREPL.
The app has two activities:
- Neko UI Demo (launcher) — a declarative UI built with neko's Clojure DSL, with a counter and buttons. The UI can be hot-reloaded from an nREPL session.
- Validation Tests — runs diagnostics on the Clojure runtime, classloader, and nREPL infrastructure. Provides controls to start/stop the nREPL server.
- JDK 17+
- Android SDK with platform API 35 installed. Set
sdk.dirinlocal.propertiesor theANDROID_HOMEenvironment variable to point to your SDK installation.
This app depends on several libraries from the clj-android organization:
| Dependency | Role |
|---|---|
| android-clojure-plugin | Gradle plugin — AOT-compiles Clojure sources and wires them into the Android build |
| neko | Idiomatic Clojure wrappers for Android APIs (UI DSL, activities, logging) |
| runtime-core | Core Android runtime support (ClojureApp, ClojureActivity base classes) |
| runtime-repl | nREPL server with on-device DEX compilation for REPL-driven development |
| clojure-patched | Clojure 1.12.0 with Android-aware classloader (used automatically in debug builds) |
Dependencies are resolved automatically: on the first build, settings.gradle.kts clones them from GitHub into build/deps/ and includes them as Gradle composite builds. No manual setup is required.
If you prefer to install dependencies to your local Maven repository instead of using composite builds:
./gradlew publishDepsToMavenLocalThis cleans, builds, and publishes all five dependencies in the correct order. If cloning fails (e.g. no network), you can clone the repositories manually into build/deps/:
mkdir -p build/deps
for repo in android-clojure-plugin neko runtime-core runtime-repl clojure-patched; do
git clone https://github.com/clj-android/$repo.git build/deps/$repo
done# Debug APK (includes nREPL server)
./gradlew assembleDebug
# Release APK (AOT-only, no REPL infrastructure)
./gradlew assembleReleaseThe APK is written to app/build/outputs/apk/.
Install and launch on a connected device or emulator:
./gradlew installDebug
adb shell am start -n com.example.clojuredroid/.MainActivityDebug builds start an nREPL server on port 7888. Forward the port and connect:
adb forward tcp:7888 tcp:7888Then connect from any nREPL client (Calva, CIDER, lein repl :connect, etc.) to localhost:7888.
Example — hot-reload the UI from the REPL:
(require '[com.example.clojuredroid.main-activity :as ui])
(reset! ui/*ui-tree
[:linear-layout {:orientation :vertical :padding [32 32 32 32]}
[:text-view {:text "Modified from REPL!" :text-size [24 :sp]}]])
(ui/reload-ui!)app/
src/main/
clojure/ Clojure source (AOT-compiled into the APK)
java/ Java source (activities)
res/ Android resources
AndroidManifest.xml
build.gradle.kts App-level build config
build.gradle.kts Top-level plugin declarations
settings.gradle.kts Repository and composite build configuration
This sample app is released under CC0 1.0. The Gradle wrapper files (gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.jar) are from the Gradle project and licensed under the Apache License 2.0.