moku Assistant
- 8 Devlogs
- 6 Total hours
A lightweight Google Assistant replacement for Android, written in C.
A lightweight Google Assistant replacement for Android, written in C.
JNI is very confusing
I spent some time getting a Foreground Service to run so that I can start working on the real assistant code inside of it
It was a pretty big headache of wrapping my head around JNI and to be honest I still don’t understand it, most of my JNI stuff is just heavily modified examples and pasted from Stack Overflow
Now that I’ve got it working, the next step is to handle audio and actually send it through Vosk!!!
To integrate Vosk properly with the new Gradle build system, I had to switch from ndk-build to CMake and add a custom task in app/build.gradle that extracts libvosk.so from the Vosk AAR and fetches vosk_api.h into the include directories ^_^
Spent a bit of time getting this to work and the app now compiles properly, linking against Vosk, with the new Gradle + CMake build system!!! 
It turns out I can’t make an Android Foreground Service without a little bit of Java/Kotlin, so I spent a hot minute migrating the entire build system to Gradle so that I can write a few Java service wrappers.
Along the way, I had some issues with Android SDK and musl libc, so the build now runs in a Docker container with docker-compose.
Did more build system things ![]()
Spent a little bit of time trying to figure out licensing for Vosk and figuring out how to integrate the Vosk shared library into my application ^_^
Licensing is still confusing but I think I have it mostly figured out! 
I’ve got the Makefile to download the Vosk AAR and extract the shared library from it, and I’ve also got Android.mk (ndk-build) to link against libvosk.so!
Oh also I made the screen red instead of green because I can™️
I got it to render a green screen to the buffer!
Next step is probably to make it start processing audio and the actual asisstant part because the UI can be done last
At the moment I might just use color screen indicators (?)
I GOT IT TO LAUNCH
IT LAUNCHES
WITH THE C BOILERPLATE CODE
For some reason rendering doesn’t work yet (Unable to lock window buffer)
I spent a bit of time getting the build system and boilerplate to work, and I now have a working Makefile that produces a signed APK with the Android NDK (ndk-build) from my C code!