Skip to content

Goal651/apk_builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 Wilson Goal's AAB Converter Tool

A powerful, cross-platform command-line tool for converting Android App Bundle (.aab) files to APK format with automatic dependency management and user-friendly features. Available for both Linux and Windows.

πŸš€ Features

  • πŸ”„ One-Click Conversion - Convert multiple AAB files to APK format instantly
  • βœ… Bundle Validation - Verify AAB file integrity before conversion
  • πŸ“‹ File Information - Display detailed AAB bundle metadata
  • πŸ”§ Auto Dependency Management - Automatically detect and install missing dependencies
  • πŸ’» Cross-Platform - Works on Linux (Ubuntu/Debian) and Windows (10/11)
  • 🎨 Colored Output - Beautiful, informative terminal output with emojis
  • πŸ“ Verbose Logging - Detailed progress information and error reporting
  • πŸ” Keystore Support - Custom signing configuration for APK generation
  • πŸ“ Flexible Output - Custom output directory support

πŸ“‹ Requirements

System Requirements

Linux

  • OS: Ubuntu/Debian-based Linux distribution
  • Architecture: x86_64 or ARM64
  • Internet: Required for bundletool download

Windows

  • OS: Windows 10/11
  • PowerShell: 5.1 or later (included in Windows 10/11)
  • Internet: Required for bundletool download

Automatic Dependencies

The tool will automatically detect and install:

  • Java Development Kit (JDK 8+)
  • Bundletool (Google's AAB conversion tool)
  • curl (Linux) or Invoke-WebRequest (Windows PowerShell)

Tip

AAB File Placement: You can place your .aab files either in the script directory (linux/ or windows/) or in the parent directory for convenience. The tool automatically searches both locations.

πŸ› οΈ Installation

Linux - Quick Start

# Clone the repository
git clone https://github.com/yourusername/apk_builder.git
cd apk_builder/linux

# Make the script executable
chmod +x main.sh

# Run the script (dependencies will be auto-installed)
./main.sh

Windows - Quick Start

# Clone the repository
git clone https://github.com/yourusername/apk_builder.git
cd apk_builder\windows

# Set execution policy (if needed, run PowerShell as Administrator)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Run the script (dependencies will be auto-installed)
.\main.ps1

# OR use the Batch wrapper (automatically bypasses execution policy)
.\main.bat

Manual Setup

Linux

# Download the script
wget https://raw.githubusercontent.com/yourusername/apk_builder/main/linux/main.sh

# Make executable
chmod +x main.sh

# Run
./main.sh

Windows

# Download the repository as ZIP or clone with git
# Extract to a folder and navigate to windows directory

# Set execution policy (run PowerShell as Administrator)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Run
.\main.ps1

# OR use the Batch wrapper
.\main.bat

πŸ“– Usage

Linux - Basic Commands

# Interactive conversion (default)
cd linux
./main.sh

# Silent conversion (no verbose output)
./main.sh --quiet

# Batch conversion (non-interactive)
./main.sh --non-interactive

# Custom output directory
./main.sh --output ./apks --verbose

# Validate AAB files
./main.sh validate

# Show AAB file information
./main.sh info

# Show help
./main.sh --help

# Show version
./main.sh --version

Windows - Basic Commands

# Interactive conversion (default)
cd windows
.\main.ps1

# Silent conversion (no verbose output)
.\main.ps1 -Quiet

# Batch conversion (non-interactive)
.\main.ps1 -NonInteractive
# Using main.bat wrapper
.\main.bat -NonInteractive

# Custom output directory
.\main.ps1 -Output .\apks -Verbose

# Validate AAB files
.\main.ps1 -Command validate

# Show AAB file information
.\main.ps1 -Command info

# Show help
.\main.ps1 -Help

# Show version
.\main.ps1 -Version

Advanced Options

Linux

# Custom keystore configuration
./main.sh --keystore my-key.keystore --alias my-alias --password mypassword

# Different build modes
./main.sh --mode universal    # Default: single APK for all devices
./main.sh --mode system       # System-signed APK
./main.sh --mode persistent   # Persistent APK

# Enable logging to file
./main.sh --log conversion.log

Windows

# Custom keystore configuration
.\main.ps1 -Keystore my-key.keystore -Alias my-alias -Password mypassword

# Different build modes
.\main.ps1 -Mode universal    # Default: single APK for all devices
.\main.ps1 -Mode system       # System-signed APK
.\main.ps1 -Mode persistent   # Persistent APK

# Enable logging to file
.\main.ps1 -Log conversion.log

🎯 Command Reference

Commands

Command Description
convert Convert AAB files to APKs (default)
validate Validate AAB bundle integrity
info Show detailed AAB file information
help Display help message

Options

Option Description Default
-h, --help Show help message
-v, --verbose Enable verbose output βœ… Enabled
--quiet Disable verbose output
-i, --interactive Interactive mode βœ… Enabled
-n, --non-interactive Non-interactive mode
-o, --output DIR Output directory Current directory
-k, --keystore PATH Keystore file path my-release-key.keystore
-a, --alias ALIAS Keystore alias my-key-alias
-p, --password PASS Keystore password 123456
-m, --mode MODE Build mode universal
-l, --log FILE Log output to file
-V, --version Show version information

πŸ”„ Workflow Examples

1. First Time Setup

# Initial run - will detect and install dependencies
./builder.sh

# Output:
# πŸ” Checking Dependencies...
#   β€’ Java Runtime Environment... βœ… Found (11.0.16)
#   β€’ curl... βœ… Found (7.81.0)
#   β€’ find utility... βœ… Found
#   β€’ disk utility (du)... βœ… Found
#   β€’ Bundletool jar... ❌ Missing
# 
# ⚠️  Missing Dependencies Detected:
#   - Bundletool 1.18.2
# 
# πŸ“‹ Actions to be taken:
#   - Download Bundletool 1.18.2 from GitHub
# 
# πŸ€” Would you like me to automatically install/download these missing dependencies? [y/N]: y
# 
# πŸ”§ Installing missing dependencies...
# 
# ➀ Processing: Bundletool 1.18.2
# 🌐 Downloading bundletool 1.18.2...
# πŸ“‘ URL: https://github.com/google/bundletool/releases/download/1.18.2/bundletool-all-1.18.2.jar
# πŸ’Ύ Target: ./bundletool-all-1.18.2.jar
# βœ… Download completed (3.2M)
# 
# πŸŽ‰ All dependencies installed successfully!

2. Converting Multiple AAB Files

# Place your .aab files in the directory
ls *.aab
# app-release.aab  game-debug.aab  tools-prod.aab

# Convert all files
./builder.sh --output ./converted_apks

# Output:
# πŸ” Checking AAB files...
# πŸ“ Found 3 AAB file(s):
# -rw-r--r-- 1 user user 12M Oct 28 07:15 app-release.aab
# -rw-r--r-- 1 user user 8.5M Oct 28 07:15 game-debug.aab
# -rw-r--r-- 1 user user 15M Oct 28 07:15 tools-prod.aab
# 
# πŸ“¦ Processing: app-release.aab
# πŸ”„ Converting to ./converted_apks/app-release.apks...
# πŸŽ‰ Created: ./converted_apks/app-release.apks
# 
# πŸ“¦ Processing: game-debug.aab
# πŸ”„ Converting to ./converted_apks/game-debug.apks...
# πŸŽ‰ Created: ./converted_apks/game-debug.apks
# 
# πŸ“¦ Processing: tools-prod.aab
# πŸ”„ Converting to ./converted_apks/tools-prod.apks...
# πŸŽ‰ Created: ./converted_apks/tools-prod.apks
# 
# 🎊 All conversions completed successfully!

3. Validation Mode

./builder.sh validate

# Output:
# πŸ” Checking AAB files for validation...
# πŸ“ Found 2 AAB file(s):
# 
# πŸ” Validating: app-release.aab
# βœ… Valid AAB: app-release.aab
# Bundle validation successful
# 
# πŸ” Validating: corrupted-bundle.aab
# ❌ Validation failed for corrupted-bundle.aab
# ERROR: Invalid bundle file
# 
# ⚠️  Validation completed with 1 invalid file(s)

πŸ› Troubleshooting

Linux - Common Issues

1. Permission Denied

chmod +x main.sh

2. Java Not Found

# The tool will automatically offer to install Java
sudo apt update
sudo apt install -y openjdk-21-jre

3. Bundletool Download Failed

# Check internet connection
curl -I https://github.com/google/bundletool/releases/latest

# Manual download if needed
wget https://github.com/google/bundletool/releases/download/1.18.2/bundletool-all-1.18.2.jar

4. Keystore Issues

# Generate a new keystore
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
                                                                                    
# Use custom keystore
./main.sh --keystore my-release-key.keystore --alias my-key-alias --password yourpassword

Windows - Common Issues

1. Execution Policy Error

# Run PowerShell as Administrator and execute:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Or for current session only:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

# TIP: Using main.bat automatically handles execution policy bypass for you.

2. Java Not Found

# Download and install Java JDK from:
# https://adoptium.net/ (recommended)
# or https://www.oracle.com/java/technologies/downloads/

# Verify installation
java -version

3. Bundletool Download Failed

# Check internet connection
Test-NetConnection github.com -Port 443

# Manual download if needed
Invoke-WebRequest -Uri "https://github.com/google/bundletool/releases/download/1.18.2/bundletool-all-1.18.2.jar" -OutFile "bundletool-all-1.18.2.jar"

4. Keystore Issues

# Generate a new keystore
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

# Use custom keystore
.\main.ps1 -Keystore my-release-key.keystore -Alias my-key-alias -Password yourpassword

5. Script Not Found or Path Issues

# Make sure you're in the correct directory
cd path\to\apk_builder\windows

# Run with full path if needed
& "C:\path\to\apk_builder\windows\main.ps1"

Error Messages

Error Cause Solution
🚫 No AAB files found No .aab files in directory Place .aab files in current directory
❌ Java is required Java not installed Allow auto-install or install manually
❌ Failed to download bundletool Network issues Check internet connection or download manually
πŸ’₯ Conversion failed Invalid AAB file Use validate command to check file integrity
Execution Policy (Windows) PowerShell security policy Run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

πŸ“ File Structure

apk_builder/
β”œβ”€β”€ README.md           # This documentation
β”œβ”€β”€ .gitignore          # Git ignore file
β”œβ”€β”€ linux/              # Linux CLI files
β”‚   └── main.sh
β”œβ”€β”€ windows/            # Windows PowerShell files
β”‚   β”œβ”€β”€ main.ps1
β”‚   └── main.bat        # Batch entry point
β”œβ”€β”€ examples/           # Example AAB files (optional)
└── logs/              # Log files directory (auto-created)

Generated Files

After conversion, you'll find:

  • *.apks - APK bundle files (can be installed directly)
  • conversion.log - Detailed conversion log (if logging enabled)

πŸ”§ Configuration

Environment Variables

# Set custom output directory
export APK_BUILDER_OUTPUT="./my_apks"

# Set custom keystore
export APK_BUILDER_KEYSTORE="./keys/release.keystore"
export APK_BUILDER_ALIAS="release"
export APK_BUILDER_PASSWORD="mypass123"

Default Keystore

The tool includes a default keystore for testing:

  • File: my-release-key.keystore
  • Alias: my-key-alias
  • Password: 123456

⚠️ Warning: Use the default keystore only for testing. Generate your own keystore for production apps.

🀝 Contributing

We welcome contributions! Whether it's:

  • πŸ› Bug fixes
  • ✨ New features
  • πŸ“ Documentation improvements
  • 🌍 Platform support (macOS, etc.)
  • πŸ§ͺ Testing and quality assurance

Please read our Contributing Guidelines for details on:

  • Development setup
  • Code style guidelines
  • Submitting pull requests
  • Reporting bugs
  • Requesting features

Quick Start for Contributors

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test thoroughly
  4. Commit: git commit -m 'feat: add amazing feature'
  5. Push: git push origin feature/amazing-feature
  6. Open a Pull Request

πŸ“„ License

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

πŸ™ Acknowledgments

  • Google for the Bundletool utility
  • Android community for AAB format support
  • Ubuntu/Debian and Windows communities for excellent platform support
  • All contributors who help improve this tool

πŸ“ž Support

πŸ”— Related Links


Created with ❀️ by Wilson Goal - 2025

If this tool helped you, consider giving it a ⭐ on GitHub!

Project Stats

Platform License Version

About

This is a cmd tool to help devs automatically convert aab to apk

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published