Arjun knew he could write that filter in C or C++ and call it via JNI (Java Native Interface). But setting up the NDK with CMake or Makefiles felt cumbersome, and he didn’t want to manage header files and build scripts for a small project. He remembered hearing about Zig — a systems programming language that can compile to native code and also cross-compile to Android (ARM, ARM64, x86) without a complex toolchain. Zig can produce .so (shared object) files that Android’s JNI can load. The Solution Arjun wrote the image filter in Zig:

init { System.loadLibrary("filter") } private external fun apply_grayscale(pixels: ByteArray, len: Int)

zig build-lib -target aarch64-linux-android -dynamic filter.zig This produced libfilter.so . No cross-compilation toolchain installation, no Android NDK setup — just Zig. He placed the .so into app/src/main/jniLibs/arm64-v8a/ . In his Android app (Kotlin), he loaded it:

Zig — Apk

Arjun knew he could write that filter in C or C++ and call it via JNI (Java Native Interface). But setting up the NDK with CMake or Makefiles felt cumbersome, and he didn’t want to manage header files and build scripts for a small project. He remembered hearing about Zig — a systems programming language that can compile to native code and also cross-compile to Android (ARM, ARM64, x86) without a complex toolchain. Zig can produce .so (shared object) files that Android’s JNI can load. The Solution Arjun wrote the image filter in Zig:

init { System.loadLibrary("filter") } private external fun apply_grayscale(pixels: ByteArray, len: Int) zig apk

zig build-lib -target aarch64-linux-android -dynamic filter.zig This produced libfilter.so . No cross-compilation toolchain installation, no Android NDK setup — just Zig. He placed the .so into app/src/main/jniLibs/arm64-v8a/ . In his Android app (Kotlin), he loaded it: Arjun knew he could write that filter in