Skip to main content

Convert Android APK files to AAB (Android App Bundle) for Google Play Store

Project description

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 apk2abb
  • 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 apk2abb

Or install from source:

git clone https://github.com/nithin434/apk2abb.git
cd apk2abb
pip install -e .

Quick Start

1. Initial Setup

After installation, set up the required tools:

# Download bundletool
apk2abb-setup

# Create a keystore for signing
apk2abb-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

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

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

3. Analyze AAB File

apk2abb-analyze output/your-app.aab

Usage

Command Line Interface

The package provides four command-line tools:

apk2abb-setup

Downloads and configures Google's bundletool:

apk2abb-setup

apk2abb-cert

Creates and manages keystores for signing:

apk2abb-cert

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

apk2abb-convert

Converts APK to AAB and signs it:

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

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

apk2abb-analyze

Displays information about an AAB file:

apk2abb-analyze output/your-app.aab

Python API

You can also use the package in your Python code:

from apk2abb import APKtoAABConverter

# Create converter instance
converter = APKtoAABConverter()

# Convert APK to AAB
converter.process_apk("path/to/your-app.apk", sign=True)
from apk2abb 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):

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

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

    apk2abb-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 apk2abb 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
apk2abb-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 ReleaseProduction (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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apk2abb-0.1.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apk2abb-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file apk2abb-0.1.0.tar.gz.

File metadata

  • Download URL: apk2abb-0.1.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apk2abb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e56500b0f930d1ac999ee472164f3a84dcc6a936a2d2727858242fed698c33d9
MD5 1f06472db59e686756e13dfa3160602c
BLAKE2b-256 834062c296df5f7b7a5fb8895eef706695ea5273bb967c0b5069195e15bb847a

See more details on using hashes here.

Provenance

The following attestation bundles were made for apk2abb-0.1.0.tar.gz:

Publisher: publish-on-tag.yml on nithin434/apk2abb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file apk2abb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: apk2abb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apk2abb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a886ead0f9fdb287b85ef32985877b5a3d4b51d631ba0c6f7a362e288f9b4003
MD5 c620e4b07e7ee78b7e73571d9428ab0f
BLAKE2b-256 769c0b9efdbdddc094a455bbccf578e9e40204bd9e2e0055997afa68a9af67f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for apk2abb-0.1.0-py3-none-any.whl:

Publisher: publish-on-tag.yml on nithin434/apk2abb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page