Ensure you are using WSL2 by running wsl -l -v in powershell, if not then convert it by running wsl --set-version Ubuntu 2
You need Java (JDK 17 specifically, as used in the CI), Node.js (for WebUI), and build tools.
# Update and install basic tools
sudo apt update
sudo apt install -y git curl wget unzip build-essential
sudo apt install cmake
# Install OpenJDK 17
sudo apt install -y openjdk-17-jdk
# Verify Java version
java -version
The build_android job requires Node.js 22 and Yarn to build the WebUI assets.
# Install NVM (Node Version Manager) - Optional but recommended
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
# Install Node 22
nvm install 22
# Install Yarn
npm install --global yarn
The CI uses specific versions (android-29, NDK 26.1.10909125). You need to match these to ensure compilation works.
- Download Command Line Tools: Download the "Command line tools only" from Android Developer or use the command below:
mkdir -p ~/android-sdk/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O cmdline-tools.zip
unzip cmdline-tools.zip -d ~/android-sdk/cmdline-tools
mv ~/android-sdk/cmdline-tools/cmdline-tools ~/android-sdk/cmdline-tools/latest
- Set Environment Variables:
Add these to your shell config (
~/.bashrcor~/.zshrc):
export ANDROID_HOME=$HOME/android-sdk
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/26.1.10909125
export ANDROID_NDK=$ANDROID_NDK_HOME
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
export RANLIB_aarch64_linux_android=$TOOLCHAIN/llvm-ranlib
export AR_aarch64_linux_android=$TOOLCHAIN/llvm-ar
Reload your shell (source ~/.bashrc).
3. Install SDK Components:
Run this command to accept licenses and install the specific versions from the CI:
yes | sdkmanager --licenses
sdkmanager "platforms;android-26" "build-tools;33.0.0" "ndk;26.1.10909125"
- Install Rust (if you haven't already):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
- Add Android Target:
The CI targets
aarch64(typical for modern phones). If you are running on an emulator, you might needx86_64-linux-androidas well.
rustup target add aarch64-linux-android armv7-linux-androideabi
- Install cargo-apk2: Important: The CI installs a specific fork/version from git. You should do the same to avoid compatibility issues.
cargo install --git https://github.com/kolbyml/cargo-apk2
- Build the App:
git clone --recursive https://github.com/kolbyml/manatan.git
cd manatan
make android_webui
make download_android_jar
make download_android_jre
cd bin/manatan_android && cargo apk2 run
- Run the App:
- Enable Developer Options and USB Debugging on your Android phone.
- Download and extract SDK Platform Tools
- Open CMD in Directory
- Install apk with
adb install -r "\\wsl.localhost\Ubuntu\home\user\manatan\target\debug\apk\mangatan_android.apk"
Troubleshooting Notes:
- Build failed: verify you are using WSL2 by running
wsl -l -vin powershell, if not then convert it by runningwsl --set-version <DistroName> 2 - Emulator: If using an emulator, it likely uses x86_64 architecture. You must run
rustup target add x86_64-linux-androidand run with--target x86_64-linux-android. - Signing:
cargo apk2 runautomatically uses a debug keystore. You do not need to perform the "Dummy Keystore" steps from the CI (those are for creating a signed Release APK). - NDK Errors: If
cargo-apk2complains about the NDK, ensureANDROID_NDK_HOMEis set correctly to the exact folder version (e.g.,.../ndk/26.1.10909125).
wsl -l -v
adb logcat RustJRE RustStdoutStderr '*:S'adb shell run-as com.mangatan.app ls -la files
adb forward tcp:4567 tcp:4567
Remove the forwards
adb forward --remove-all