beetlebug

Install for Android

This page builds the ztk program of your computer and the Android runtime: the library libztk.so of each Android target, which ztk bundle puts in each APK.

Build the runtime

Install Zig 0.17.0 and the Android NDK. Set ANDROID_NDK_HOME to the folder of the NDK:

export ANDROID_NDK_HOME=$HOME/android/android-ndk-r28c
git clone https://github.com/beetlebugorg/ztk
cd ztk
zig build

zig build makes zig-out/bin/ztk for your computer. Then build the runtime of each target that you need:

Target Command
A phone or a tablet zig build android -Dtarget=aarch64-linux-android -Doptimize=ReleaseFast
The emulator on an x86-64 computer zig build android -Dtarget=x86_64-linux-android -Doptimize=ReleaseFast

Each runtime goes in zig-out/lib/ztk/runtime/TARGET/, where zig-out/bin/ztk finds it. The build uses the NDK folder of the host: windows-x86_64, darwin-x86_64, or linux-x86_64.

Check the install

Start the emulator, or connect a phone with USB debugging on, and run the gallery:

zig-out/bin/ztk --android examples/platform-gallery.tcl

The next page, Develop, has each step of this command.