Metadata-Version: 2.4
Name: apk2aab
Version: 0.1.0
Summary: Convert Android APK files to AAB (Android App Bundle) for Google Play Store
Home-page: https://github.com/nithinjambula/apk2aab
Author: Nithin Jambula
Author-email: Nithin Jambula <nithinjambula89@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/nithinjambula/apk2aab
Project-URL: Bug Reports, https://github.com/nithinjambula/apk2aab/issues
Project-URL: Source, https://github.com/nithinjambula/apk2aab
Keywords: apk,aab,android,app bundle,google play store,converter
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# APK to AAB Converter

[![PyPI version](https://badge.fury.io/py/apk2aab.svg)](https://badge.fury.io/py/apk2aab)
[![Python Support](https://img.shields.io/pypi/pyversions/apk2aab.svg)](https://pypi.org/project/apk2aab/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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
  ```bash
  java -version
  ```
- **Python 3.7+**: Required for running the package
- **keytool**: Usually comes with Java (for certificate management)

## Installation

Install from PyPI:

```bash
pip install apk2aab
```

Or install from source:

```bash
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:

```bash
# 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

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

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

### 3. Analyze AAB File

```bash
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:
```bash
apk2aab-setup
```

#### `apk2aab-cert`
Creates and manages keystores for signing:
```bash
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:
```bash
# 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:
```bash
apk2aab-analyze output/your-app.aab
```

### Python API

You can also use the package in your Python code:

```python
from apk2aab import APKtoAABConverter

# Create converter instance
converter = APKtoAABConverter()

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

```python
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):
   ```bash
   apk2aab-setup     # Download bundletool
   apk2aab-cert      # Create keystore
   ```

2. **Convert** (repeat as needed):
   ```bash
   apk2aab-convert your-app.apk
   ```

3. **Verify**:
   ```bash
   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:
   ```bash
   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:
   ```python
   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
```bash
# 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
```bash
# List keystore contents
keytool -list -v -keystore certs/iot_marketplace_app.keystore

# Verify with password (default: iot_app_12345)
```

### Bundletool not downloaded
```bash
# 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:
```bash
# 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](https://play.google.com/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](LICENSE) file for details.

## Acknowledgments

- Uses [Google's bundletool](https://github.com/google/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](https://github.com/yourusername/apk2aab/issues)
- 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**
