🔐 Login Required
Credits: This tutorial is adapted and enhanced based on original work by zryyoung on GitHub.
All rights reserved. For personal and non-commercial use only.
Termux + Acode Android Project Build and Installation Guide¶
This guide explains how to build, debug, and install Kotlin/Java projects on Android using Termux / ZeroTermux + Acode.
1. Install Required Tools¶
Install Termux or ZeroTermux¶
It is recommended to use ZeroTermux for better compatibility. Download it from its official site or GitHub.
Install Acode Editor¶
Download Acode from Google Play or its GitHub page.
Install Acode Plugin: acodex-terminal¶
Open Acode settings, search and install the acodex-terminal
plugin.
2. Configure ZeroTermux Environment¶
Open Termux and run:
Install the acodex-server backend:
curl -sL https://raw.githubusercontent.com/bajrangCoder/acode-plugin-acodex/main/installServer.sh | bash
For older versions, start the service manually each time Termux restarts:
Newer versions:
To stop the server:
Enable auto-start using termux-services:
#!/data/data/com.termux/files/usr/bin/sh
# Create service directory
mkdir -p /data/data/com.termux/files/usr/var/service/axs
# Write run file
cat > /data/data/com.termux/files/usr/var/service/axs/run <<EOF
#!/data/data/com.termux/files/usr/bin/sh
exec axs
EOF
# Make it executable
chmod +x /data/data/com.termux/files/usr/var/service/axs/run
# Enable service
sv-enable axs
# Exit terminal
exit # Then reopen
In Acode, press Ctrl + K
to open the terminal panel.
3. Install Android Build Tools¶
In Termux, install dependencies:
4. Install Android NDK and SDK¶
Download Links (by Github@Lzhiyong):¶
-
NDK:
-
SDK:
Extract to a specified directory:¶
Optionally remove zip files:
5. Configure Environment Variables¶
Edit your config:
Add:
export NDK_HOME=/data/data/com.termux/files/usr/opt/android-ndk-r27b
# export PATH=$PATH:$NDK_HOME
export ANDROID_SDK_ROOT=/data/data/com.termux/files/usr/opt/android-sdk
export PATH=$PATH:/data/data/com.termux/files/usr/opt/gradle/gradle-8.14/bin/:$NDK_HOME:$ANDROID_SDK_ROOT/tools/:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/build-tools
# Auto-start acodex-server
sudo ps aux | grep "acodex-server" | grep -v grep > /dev/null || acodex-server &
Save with Ctrl + S
, exit with Ctrl + X
.
Reload config:
6. Create APK Auto Install Script¶
Create a file:
Paste the following:
#!/bin/bash
PROJECT_PATH="$(pwd)"
APK_PATH="${PROJECT_PATH}/app/build/outputs/apk/debug/app-debug.apk"
if [ -f "$APK_PATH" ]; then
echo "APK found: $APK_PATH, starting installation..."
termux-open "$APK_PATH"
if [ $? -eq 0 ]; then
echo "Installation request sent."
else
echo "Failed to call package installer."
exit 1
fi
else
echo "APK file not found."
exit 1
fi
Make it executable:
7. Set Acode Default Build Command¶
In Acode settings > Default Commands:
8. Fix Build Errors (aapt2 Issue)¶
If you encounter aapt2
errors, patch with Termux-installed version:
find ~/.gradle -name 'aapt2-*-linux.jar' -type f | xargs -I{} jar -uvf {} -C /data/data/com.termux/files/usr/bin aapt2
Conclusion¶
Now you can: - Write Kotlin/Java projects using Acode - Build them with Gradle - Install and test APKs on your device
Recommended tools: Termux + Acode + Mixplorer (file manager)