Skip to main content

APK to AAB Converter

PyPI version Python Support License: MIT

Convert your Android APK files to Android App Bundle (AAB) format for Google Play Store deployment.

Overview

This package automates the conversion of APK files to AAB (Android App Bundle) format using Google's bundletool, without requiring Android Studio. Perfect for publishing apps to the Google Play Store.

Features

  • ✅ Simple Installation: pip install apk2aab
  • ✅ Automated Setup: Downloads bundletool automatically
  • ✅ Certificate Management: Create and manage keystores
  • ✅ APK to AAB Conversion: Convert APK files to AAB format
  • ✅ Automatic Signing: Sign AAB files with your keystore
  • ✅ AAB Analysis: Inspect AAB file contents
  • ✅ Comprehensive Logging: Track all operations

Prerequisites

  • Java 11+: Required by Google's bundletool
    java -version
    
  • Python 3.7+: Required for running the package
  • keytool: Usually comes with Java (for certificate management)

Installation

Install from PyPI:

pip install apk2aab

Or install from source:

git clone https://github.com/yourusername/apk2aab.git
cd apk2aab
pip install -e .

Quick Start

1. Initial Setup

After installation, set up the required tools:

# Download bundletool
apk2aab-setup

# Create a keystore for signing
apk2aab-cert

This will create the following directories in your current working directory:

  • tools/ - Bundletool and other required tools
  • certs/ - Your keystores and certificates
  • logs/ - Log files from operations
  • output/ - Generated AAB files

2. Convert APK to AAB

apk2aab-convert path/to/your-app.apk

That's it! Your AAB file will be created in the output/ directory.

3. Analyze AAB File

apk2aab-analyze output/your-app.aab

Usage

Command Line Interface

The package provides four command-line tools:

apk2aab-setup

Downloads and configures Google's bundletool:

apk2aab-setup

apk2aab-cert

Creates and manages keystores for signing:

apk2aab-cert

Important: Change the default passwords in production! Edit the keystore credentials in certs/iot_marketplace_app.keystore.

apk2aab-convert

Converts APK to AAB and signs it:

# Convert and sign
apk2aab-convert your-app.apk

# Convert without signing
apk2aab-convert your-app.apk --no-sign

apk2aab-analyze

Displays information about an AAB file:

apk2aab-analyze output/your-app.aab

Python API

You can also use the package in your Python code:

from apk2aab import APKtoAABConverter

# Create converter instance
converter = APKtoAABConverter()

# Convert APK to AAB
converter.process_apk("path/to/your-app.apk", sign=True)
from apk2aab import create_keystore

# Create a custom keystore
create_keystore(
    keystore_path="my-app.keystore",
    keystore_pass="my-secure-password",
    alias="my-app-key",
    alias_pass="my-key-password",
    validity_days=25550  # ~70 years
)

Directory Structure

After installation and setup, your working directory will have:

your-project/
├── tools/              # Bundletool JAR (auto-downloaded)
├── certs/              # Your keystores  
│   └── iot_marketplace_app.keystore
├── output/             # Generated AAB files
│   └── your-app.aab
└── logs/               # Operation logs
    ├── setup.log
    ├── cert.log
    └── conversion.log

Note: These directories are created in your current working directory, NOT in the package installation directory.

Workflow

  1. Setup (one-time):

    apk2aab-setup     # Download bundletool
    apk2aab-cert      # Create keystore
    
  2. Convert (repeat as needed):

    apk2aab-convert your-app.apk
    
  3. Verify:

    apk2aab-analyze output/your-app.aab
    

The AAB file will be created in the output/ directory and is ready for Google Play Store upload!

Configuration

Keystore Credentials

⚠️ Security Warning: The default keystore uses demo credentials. For production:

  1. Create your own keystore:

    keytool -genkey -v -keystore certs/my-app.keystore \
      -keyalg RSA -keysize 2048 -validity 25550 \
      -alias my-app-key
    
  2. Update your code to use custom credentials:

    from apk2aab import APKtoAABConverter
    
    converter = APKtoAABConverter()
    converter.keystore_path = "certs/my-app.keystore"
    converter.keystore_pass = "your-secure-password"
    converter.key_alias = "my-app-key"
    converter.key_pass = "your-key-password"
    
    converter.process_apk("your-app.apk")
    

Bundletool Version

The package uses bundletool version 1.15.6 by default. To use a different version, you can download it manually to tools/bundletool.jar.

Troubleshooting

Java not found

# Check Java installation
java -version

# Install Java (Ubuntu/Debian)
sudo apt install default-jdk

# Install Java (macOS)
brew install openjdk@11

# Install Java (Windows)
# Download from https://www.oracle.com/java/technologies/downloads/

Keystore issues

# List keystore contents
keytool -list -v -keystore certs/iot_marketplace_app.keystore

# Verify with password (default: iot_app_12345)

Bundletool not downloaded

# Manually run setup again
apk2aab-setup

Logs

All operations are logged to the logs/ directory:

  • setup.log - Bundletool download logs
  • cert.log - Certificate operations
  • conversion.log - APK to AAB conversion logs

View logs in real-time:

# Windows PowerShell
Get-Content logs/conversion.log -Wait

# Linux/Mac
tail -f logs/conversion.log

Play Store Deployment

After generating your AAB file:

  1. Sign in to Google Play Console
  2. Select your app (or create a new one)
  3. Go to Release → Production (or Testing track)
  4. Click Create new release
  5. Upload your AAB file from the output/ directory
  6. Complete the release details and publish

Requirements

  • Python 3.7 or higher
  • Java 11 or higher
  • Internet connection (for initial bundletool download)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

Acknowledgments

  • Uses Google's bundletool for AAB generation
  • Built for easy Play Store deployment without Android Studio

Support

If you encounter any issues or have questions:

  • Open an issue on GitHub
  • Check the logs in the logs/ directory for detailed error messages

Changelog

Version 0.1.0 (2026-02-15)

  • Initial release
  • APK to AAB conversion
  • Automatic bundletool download
  • Keystore management
  • AAB signing
  • Command-line interface
  • Python API

Made with ❤️ for Android developers

Metadata

Release files for apk2aab 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apk2aab 0.1.0
File Size Uploaded
apk2aab-0.1.0.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apk2aab 0.1.0
File Interpreter ABI Platform
apk2aab-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.3 kB

Release files / apk2aab-0.1.0.tar.gz

Download URL apk2aab-0.1.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7eda1b197693cb56b5f8c18a07781f4a87cd9494c5947c409ec8f098cd93c589
BLAKE2b-256 checksum
How to use checksums
d60d2bc398895b80a399b26746c8b94927cd92dadc4be35d782bb8e06c565abf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / apk2aab-0.1.0-py3-none-any.whl

Download URL apk2aab-0.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
209740c562bde4c6a3d4aa20cbe4f8097ec561a024cba2905fa12a7f3bb286e9
BLAKE2b-256 checksum
How to use checksums
6bae8526d32e5928c7dc71a16df544f08913c0605b6897c492c4ec0c386dba96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page