A powerful and user-friendly Node.js CLI tool to convert Android App Bundles (AAB) to APKs using Google's BundleTool, with interactive prompts and automatic keystore management.
- π Two modes: Interactive and automated build mode
- π₯ Automatic BundleTool download - no manual setup required
- π Automatic keystore creation - generates signed APKs ready for distribution
- π― Smart AAB detection - finds
.aabfiles automatically - π Interactive prompts with sensible defaults
- π‘οΈ Universal APK generation compatible with all devices
- π¨ Beautiful CLI interface with emojis and clear feedback
- β‘ Cross-platform support (Windows, macOS, Linux)
- π Organized output - uses dedicated build folder on desktop
- π§ CI/CD friendly - scriptable build mode
npm install -g generate-apknpm install generate-apk
npx generate-apkNavigate to a directory containing your .aab file and run:
generate-apkWhat it does:
- π₯ Downloads BundleTool automatically (if not present)
- π Detects
.aabfiles in your directory - π Prompts for keystore details or creates one automatically
- βοΈ Generates signed APK with your specified name
For automated workflows and CI/CD:
generate-apk build <file.aab> --name=<output.apk>What it does:
- π Uses/creates
buildfolder on desktop - π Creates keystore automatically (no prompts)
- βοΈ Generates signed APK with default settings
- π± Ready for distribution
# Basic usage - finds .aab files automatically
generate-apk
# Direct file specification
generate-apk app-release.aabInteractive workflow:
$ generate-apk
β
Found bundletool-all-1.18.1.jar
βοΈ Only one .aab found, using app-release.aab
π Signing setup (press Enter for defaults or "skip" for unsigned)
Keystore path [chatreal-release.keystore] or "skip":
π Keystore not found. Create new keystore? (Y/n): y
π Creating keystore...
β
Keystore created: chatreal-release.keystore
π§ Building signed APKS from app-release.aabβ¦
π¦ Extracting universal.apkβ¦
Enter final APK name [app-release-signed.apk]: MyApp-v1.2.3.apk
β
APK ready: MyApp-v1.2.3.apk# Basic build command
generate-apk build app-release.aab --name=myapp.apk
# Multiple APKs (all go to same build folder)
generate-apk build app-release.aab --name=release.apk
generate-apk build app-debug.aab --name=debug.apkBuild mode workflow:
$ generate-apk build app-release.aab --name=myapp.apk
π Using existing build directory: /home/user/Desktop/build
β
Found bundletool-all-1.18.1.jar
β
Found keystore: release.keystore
π§ Building signed APKS from app-release.aab...
π¦ Extracting universal.apk...
β
APK conversion completed!
π± APK file: myapp.apk (signed)
π Location: /home/user/Desktop/build
π Signed with keystore: release.keystore
π‘ Your signed APK is ready for distribution and installation!generate-apk # Auto-detect AAB files
generate-apk <file.aab> # Specify AAB file
generate-apk --help # Show helpgenerate-apk build <file.aab> --name=<output.apk>Build mode features:
- β
Uses existing
buildfolder on desktop (creates if needed) - β No interactive prompts - uses defaults
- β Automatically creates and reuses keystore
- β Generates signed APKs ready for distribution
- β Perfect for automation and CI/CD
- Prompts for keystore path, alias, and passwords
- Can create new keystores with custom details
- Supports existing keystores
- Option to skip signing (unsigned APK)
- Automatically creates
release.keystorein build folder - Uses secure defaults: RSA 2048-bit, 10,000-day validity
- Reuses existing keystore for subsequent builds
- Fallback to unsigned APK if keystore creation fails
Default keystore settings:
- File:
release.keystore - Alias:
release - Store password:
123456 - Key password:
123456
Note: For production apps, consider using custom keystores with stronger passwords.
generate-apk/
βββ bin/
β βββ generate-apk.js # π CLI entry point with command routing
βββ lib/
β βββ index.js # π οΈ Interactive mode logic
β βββ build.js # ποΈ Build mode logic
β βββ utils.js # π§ Cross-platform utilities
βββ package.json # π Package configuration
βββ README.md # π Documentation
Creates files in current directory:
your-project/
βββ app-release.aab # Your input file
βββ MyApp-v1.2.3.apk # Generated APK
βββ bundletool-all-1.18.1.jar # Downloaded tool
βββ chatreal-release.keystore # Created keystore
Creates organized build folder on desktop:
~/Desktop/build/
βββ bundletool-all-1.18.1.jar # Downloaded once, reused
βββ release.keystore # Auto-generated keystore
βββ myapp.apk # Your signed APKs
βββ release.apk # Multiple APKs supported
βββ debug.apk # All in one place
- Node.js 12.0.0 or higher
- Java Runtime Environment (JRE) 8+ for BundleTool and keystore operations
- Android App Bundle (.aab) file
Ubuntu/Debian:
sudo apt update && sudo apt install openjdk-11-jdkmacOS:
brew install openjdk@11Windows: Download from Oracle or use OpenJDK
# Build your React Native app
cd android && ./gradlew bundleRelease
# Convert to APK
cd app/build/outputs/bundle/release
generate-apk build app-release.aab --name=MyApp-v1.0.0.apk# GitHub Actions example
- name: Convert AAB to APK
run: |
npm install -g generate-apk
generate-apk build app/build/outputs/bundle/release/app-release.aab --name=release.apk{
"scripts": {
"build-apk": "generate-apk build android/app/build/outputs/bundle/release/app-release.aab --name=myapp.apk",
"build-apk-interactive": "generate-apk"
}
}"No .aab files found"
- Ensure you're in the correct directory
- Check that your file has the
.aabextension - Use direct file path:
generate-apk my-app.aab
"java: command not found"
- Install Java JDK/JRE 8 or higher
- Ensure
javaandkeytoolare in your system PATH - Test with:
java -versionandkeytool -help
"keytool: command not found"
- Install Java JDK (not just JRE)
- On some systems:
sudo apt install openjdk-11-jdk
Permission denied (Linux/macOS)
- Run:
chmod +x ./bin/generate-apk.js - Or install globally:
npm install -g generate-apk
PowerShell errors (Windows)
- Ensure PowerShell execution policy allows scripts
- Run PowerShell as administrator if needed
The tool provides detailed feedback at each step:
- β Success indicators
- π₯ Download progress
- π§ Build process status
β οΈ Warning messages- β Clear error descriptions
- v1.1.0: Added build mode, cross-platform unzip, automatic keystore creation
- v1.0.0: Initial release with interactive mode
- Google BundleTool - The official tool for Android App Bundle operations
- Android Developer Community - For feedback and feature requests
- Node.js Community - For the excellent ecosystem
- π Issues: GitHub Issues
- π§ Email: guptashaurya2002@gmail.com
β If this tool helped you, please give it a star on GitHub! β
Made with β€οΈ by Shaurya Gupta