Roc platform for native Android apps
It's been a long time since I've written a post here... I've made a bad habit of sharing a link to a GitHub repo and leaving it to the user to infer from context what I'm excited about. So I'm going to try and catch up a little after neglecting my blog for a couple of years.
If you have been following along in the Roc Zulip you might have heard of my work experimenting with a signals-based UI engine in roc-signals. That project started as a harebrained idea, and for a long time its only purpose was to drive compiler development forward (by intentionally breaking things, or making absurd things in WASM to expose bugs).
After a while the bugs stopped blocking progress on the platform and the reactive engine and it started looking like it could become a useful tool. My focus shifted to exploring different ergonomic and performance trade-offs which has led to the current implementation. roc-signals is focussed on the browser. I've got other projects exploring what a platform might look like for native apps.
One of my most recent experiments is roc-native-android. I've ported the reactive engine from roc-signals across to sit on top of a Zig-based JNI bridge and a Kotlin host. This means anyone can build and package a native Android app using a Roc. It has some significant gaps in features; but there isn't anything blocking development of those. The latest release should be enough for simple apps; and we can extend it further if anyone is interested.
Here is an illustration of the Todo app example working in my emulator.
I don't have any mobile development experience, beyond a few hello-world tutorials over the years. I delegated much of the implementation to Opus 5.5, and put this together over a few hours on the weekend.
My goal here isn't to compete with mature mobile frameworks; but to help me validate the signals-based UI integration, find bugs or inform features for the reactive engine in roc-signals, and to share with the Roc community.
If anyone finds this work useful and is interested in helping me extend this, I would be most grateful.
If someone takes inspiration from this, or uses this as a starting point to build a Roc platform for native mobile development I will be stoked.
The platform release includes a companion CLI tool, android.roc, which can scaffold a starter app and help build it into an APK.
Note: I've only run this in an emulator on my MacBook; if anyone tests this out and finds an issue, please let me know.