Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
ZTz edited this page Dec 28, 2022 · 6 revisions

Home

For lua api documentation: Lua Api documentation

Build for Android

The following dependencies are required to build from source.

The following steps are for building from source. Download the Android SDK and Android NDK.

# install openjdk-17
pkg install openjdk-17

# install gradle
pkg install gradle

Add a local.properties file to the root of the project as below

# modify the local.properties file
# although ndk.dir has been deprecated, but it still works
sdk.dir=/path/to/android-sdk
ndk.dir=/path/to/android-ndk
# for example:
sdk.dir=/data/data/com.termux/files/home/android-sdk
ndk.dir=/data/data/com.termux/files/home/android-ndk-r23b

Execute the gradle build command to start building the android app, when building for the first time, the below error will occur. this is because the gradle plugin will download a corresponding version of aapt2-7.0.3-7396180-linux.jar, we need to replace it.

Replace the aapt2 in aapt2-7.0.3-7396180-linux.jar with aapt2-7.0.3-7396180-linux.jar or Making AGP jar file you need sdk-tools/build-tools/aapt2

# aapt2 is inside the jar file(aapt2-7.0.3-7396180-linux.jar)
# because the aapt2 is x86_64 architecture not aarch64, so we need to replace it
# execute the find command to search aapt2-xxx-linux.jar, then replace it
cd ~/.gradle
find . -type f -name aapt2-*-linux.jar
cp /path/to/aapt2-7.0.3-7396180-linux.jar /the/output/from/find/command

If an error occurs during the build app, this may be a network problem, please execute the gradle build again or execute the gradle build --info for more information.

Tutorial by: Lzhiyong/termux-ndk

Clone this wiki locally