Skip to content

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Termux Android Build Environment

License Platform Architecture GitHub Stars GitHub Issues

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.

๐ŸŒŸ Features

  • 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

๐Ÿ“‹ Prerequisites

  • 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

๐Ÿš€ Quick Installation

For Bash Users (.bashrc)

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.sh

For Zsh Users (.zshrc)

curl -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

๐Ÿ› ๏ธ What Gets Installed

Core Components

  • 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

Termux Packages

openjdk-17 wget unzip nano git which libxml2 libxslt python android-tools

๐ŸŽฎ Script Operations

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

๐Ÿ“ Directory Structure

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/

๐Ÿ”ง Environment Variables

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"

๐ŸŽฏ Usage Examples

Check Installation Status

./android_env_bash.sh
# Select option 7

Install Only Missing Components

./android_env_bash.sh
# Select option 2

Uninstall Android Components (Keep Java)

./android_env_bash.sh
# Select option 6

๐Ÿ“Š Progress Indicators

The 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

๐Ÿ”’ Safety Features

  • 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

๐Ÿ› Troubleshooting

Common Issues

  1. sdkmanager not found

    # Manually install Android tools
    pkg install android-tools
  2. Permission denied errors

    # Ensure script is executable
    chmod +x android_env_bash.sh
  3. Download failures

    # Check internet connection and retry
    ping google.com

Manual Environment Setup

If automatic sourcing fails:

source ~/.bashrc  # or ~/.zshrc

๐Ÿ“ˆ Performance Tips

  • 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

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • 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

๐Ÿ“ž Support

๐Ÿ“ฑ Compatible Devices

Tested on:

  • Samsung Galaxy series (ARM64)
  • Google Pixel series (ARM64)
  • OnePlus devices (ARM64)
  • Xiaomi devices (ARM64)

โš ๏ธ Disclaimer

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

```

About

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.

Resources

Stars

22 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages