A comprehensive, professional Android build environment setup for Termux on ARM64 devices. This script automates the entire process of installing Java, Gradle, Android SDK, and all necessary tools to build Android applications directly on your Android device.
- Complete Android Development Environment - Sets up everything needed for Android app development
- ARM64 Optimized - Specifically designed for ARM64 architecture with compatible SDK tools
- Dual Shell Support - Works with both Bash (.bashrc) and Zsh (.zshrc) configurations
- Smart Component Detection - Checks for missing components and installs only what's needed
- Progress Tracking - Real-time download progress with percentage indicators
- Modular Operations - Install, check, uninstall individual components
- Safe Uninstallation - Removes Android/Gradle components while preserving Java
- Custom Progress Indicators - Visual feedback during long operations
- Termux App - Install from F-Droid or Google Play
- Android 7.0+ - Minimum Android version requirement
- ARM64 Device - Script optimized for 64-bit ARM processors
- Internet Connection - Required for downloading components (~300MB total)
- Storage Space - At least 1GB free space recommended
curl -O https://raw.githubusercontent.com/ahksoft/termux-android-build-environment/main/android_env_bash.sh
chmod +x android_env_bash.sh
./android_env_bash.shcurl -O https://raw.githubusercontent.com/ahksoft/termux-android-build-environment/main/android_env_zsh.sh
chmod +x android_env_zsh.sh
./android_env_zsh.sh- OpenJDK 17 - Java development kit for Android development
- Gradle 7.6.6 - Build automation tool for Android projects
- Android SDK - Core Android development kit
- Command-line Tools - Official Android SDK command-line interface
- Platform-tools - ADB and fastboot utilities
- Build-tools 35.0.2 - Android build tools for API level 35
- Android Platform 35 - Android API level 35 platform files
openjdk-17 wget unzip nano git which libxml2 libxslt python android-tools| Option | Description |
|---|---|
| 1 | Complete installation (all components) |
| 2 | Install missing components only |
| 3 | Install ARM64 SDK tools from GitHub |
| 4 | Source shell configuration |
| 5 | Accept licenses and install packages |
| 6 | Uninstall Android components (keep Java) |
| 7 | Check installation status |
| 8 | Exit |
After installation, the following structure is created:
$PREFIX/opt/
โโโ Android/
โ โโโ sdk/
โ โโโ cmdline-tools/
โ โ โโโ latest/
โ โโโ platform-tools/
โ โโโ build-tools/
โ โ โโโ 35.0.2/
โ โโโ platforms/
โ โโโ android-35/
โโโ gradle/
โโโ gradle-7.6.6/
The script automatically configures these environment variables:
export ANDROID_HOME="$PREFIX/opt/Android/sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
export PATH="$PATH:$ANDROID_HOME/build-tools/35.0.2"
export JAVA_HOME="/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk"
export GRADLE_HOME="$PREFIX/opt/gradle"
export PATH="$PATH:$GRADLE_HOME/bin"./android_env_bash.sh
# Select option 7./android_env_bash.sh
# Select option 2./android_env_bash.sh
# Select option 6The script provides visual feedback during operations:
- Download Progress:
Downloading Gradle 7.6.6: 45% - Installation Progress:
[INFO] Installing Command-line Tools... [โ] - Operation Completion:
[SUCCESS] Gradle installed successfully
- Backup Creation - Automatically backs up shell configuration files
- Selective Uninstall - Only removes Android/Gradle components, preserves Java
- Error Handling - Graceful error handling with descriptive messages
- Permission Checks - Validates permissions before operations
- Network Resilience - Handles download failures gracefully
-
sdkmanager not found
# Manually install Android tools pkg install android-tools -
Permission denied errors
# Ensure script is executable chmod +x android_env_bash.sh -
Download failures
# Check internet connection and retry ping google.com
If automatic sourcing fails:
source ~/.bashrc # or ~/.zshrc- Storage: Ensure sufficient storage space (1GB+ recommended)
- Network: Use stable Wi-Fi for downloads (~300MB total)
- Battery: Keep device charged during installation
- Time: Initial setup takes 10-15 minutes depending on connection
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Termux Team - For the excellent Android terminal emulator
- Google Android Team - For Android SDK tools
- Gradle Team - For the build automation tool
- OpenJDK Team - For the Java development kit
- lzhiyong - For ARM64 compatible Android SDK tools
- Issues: GitHub Issues
- Documentation: Wiki
- Releases: GitHub Releases
Tested on:
- Samsung Galaxy series (ARM64)
- Google Pixel series (ARM64)
- OnePlus devices (ARM64)
- Xiaomi devices (ARM64)
This script modifies your Termux environment and installs significant software components. While it includes safety features, always ensure you have backups of important data before running installation scripts.
Made with โค๏ธ for the Android development community
```