universal-apk-builder
v1.0.0-beta.1
Published
CLI tool to easily convert Android App Bundle (.aab) files into universal APKs using Google bundletool
Maintainers
Readme
Universal APK Builder (uab / universal-apk-builder)
A blazing fast, zero-configuration Node.js CLI & library to convert Android App Bundle (
.aab) files into universal.apkfiles using Google's officialbundletool.
⚡ Features
- 🚀 Zero Manual Setup: Automatically downloads and caches the latest official Google
bundletoolJAR. - 📦 Simple CLI: Convert with a single command:
uab app.aaboruab app.aab output.apk. - 💬 Interactive Mode: Run without arguments to use the interactive file picker prompts.
- 🔑 Keystore / Signing Support: Optional flags to sign the generated universal APK directly.
- 🛠️ Programmatic TypeScript/JavaScript API: Can be imported and used directly in Node.js scripts or CI/CD pipelines.
- ☕ Pre-flight Checks: Validates Java runtime and provides helpful instructions if missing.
📋 Prerequisites
- Node.js:
v18.0.0or higher - Java: Java Runtime (JDK 11+) installed and available in your
PATH(Download Eclipse Temurin / OpenJDK)
📦 Installation
Run directly with npx (No install needed)
npx universal-apk-builder ./app-release.aab
# or
npx uab ./app-release.aabGlobal Install
npm install -g universal-apk-builderLocal Project Install
npm install --save-dev universal-apk-builder🚀 Usage
1. Basic Usage (Positional Arguments)
# Generates ./app-release-universal.apk
uab ./app-release.aab
# Specify custom output path
uab ./app-release.aab ./build/my-universal-app.apk2. Using Options / Flags
uab -i ./app-release.aab -o ./dist/output.apk3. Interactive Mode
Run without arguments and follow the terminal prompts:
uab4. Signed Universal APK
You can provide keystore credentials to sign the output APK:
uab ./app.aab ./app-signed.apk \
--ks ./my-release-key.jks \
--ks-pass "secretpassword" \
--ks-key-alias "my-alias" \
--key-pass "keypassword"5. Overwrite Existing Files
uab ./app.aab ./output.apk --force📖 CLI Reference
Usage: uab [options] [command] [bundle] [output]
Arguments:
bundle Path to the input .aab file
output Destination path or directory for the output .apk
Options:
-v, --version Output the current version
-i, --input <path> Path to the input .aab file
-o, --output <path> Destination path or directory for the output .apk
-f, --force Overwrite destination file if it already exists (default: false)
--bundletool-path <path> Custom path to bundletool-all.jar
--ks <path> Path to keystore file for signing
--ks-pass <pass> Keystore password
--ks-key-alias <alias> Key alias
--key-pass <pass> Key password
-h, --help Display help for command
Commands:
setup-bundletool Download or verify bundletool.jar in local cache💻 Programmatic API (TypeScript / Node.js)
You can also use universal-apk-builder directly inside your build scripts:
import { buildUniversalApk, checkJavaEnvironment } from 'universal-apk-builder';
async function main() {
// Check Java environment
const java = checkJavaEnvironment();
console.log('Java version:', java.versionString);
// Build universal APK
const result = await buildUniversalApk({
bundlePath: './android/app/build/outputs/bundle/release/app-release.aab',
outputPath: './build/universal.apk',
force: true,
});
console.log(`Generated: ${result.outputPath} (${result.formattedSize}) in ${result.durationMs}ms`);
}
main().catch(console.error);🛠️ How It Works
- Java Check: Verifies that Java 11+ is installed.
- Bundletool Resolver: Automatically downloads Google's
bundletool-all.jarto~/.universal-apk-builder/on first run. - Build APKS: Executes
bundletool build-apks --bundle=<file> --output=<temp.apks> --mode=universal. - Extract APK: Extracts
universal.apkdirectly from the.apkspackage to your designated output path. - Clean: Deletes temporary files and returns the output path and file size.
👨💻 Author
Vivek Kushwaha
- GitHub: @vivekkushwaha66
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
