Skip to main content

AndroBuilder

A pure Python Android APK builder with automatic SDK/NDK management. Build Android apps without Gradle!

Features

  • 🚀 Pure Python - No Gradle or Android Studio required
  • 📦 Auto SDK/NDK Management - Automatically downloads and installs required tools
  • 🔧 Full Control - Complete control over the build process
  • 🎯 Multi-DEX Support - Handle large apps with 65k+ methods
  • 🔒 ProGuard Integration - Code shrinking and obfuscation
  • 📱 NDK Support - Compile native C/C++ libraries
  • ⚡ Fast Builds - Optimized build pipeline
  • 🎨 AAPT2 Support - Modern resource compilation
  • 🔐 Flexible Signing - Debug or release keystores

Installation

pip install androbuilder

Quick Start

Python API

from androbuilder import Builder

# Simple build
builder = Builder(path="./MyApp", sdk="34")
apk_path = builder.build("./output")
print(f"APK built: {apk_path}")

# Advanced build
builder = Builder(
    path="./MyApp",
    sdk="34",                    # Auto-downloads SDK 34
    ndk="25.1.8937393",         # Auto-downloads NDK
    multidex=True,
    proguard=True,
    proguardconfig={
        'rules': ['proguard-rules.pro'],
        'optimize': True
    },
    sign=True,
    signconfig={
        'path': 'release.keystore',
        'alias': 'mykey',
        'password': 'mypassword'
    },
    versioncode=2,
    versionname="1.0.1",
    verbose=True
)

apk_path = builder.build("./output")

Command Line

# Basic build
androbuilder build ./MyApp

# Advanced build
androbuilder build ./MyApp \
    --sdk 34 \
    --ndk 25.1.8937393 \
    --multidex \
    --proguard \
    --signconfig release.keystore mykey mypass \
    --verbose \
    --output ./dist

# Show project info
androbuilder info ./MyApp

# Show version
androbuilder version

Project Structure

Your Android project should have this structure:

MyApp/
├── AndroidManifest.xml
├── src/
│   └── com/
│       └── example/
│           └── app/
│               └── MainActivity.java
├── res/
│   ├── layout/
│   │   └── activity_main.xml
│   ├── values/
│   │   └── strings.xml
│   └── drawable/
├── libs/                    # Optional: JAR dependencies
├── jni/                     # Optional: Native code
│   ├── Android.mk
│   └── native-lib.cpp
└── proguard-rules.pro      # Optional: ProGuard rules

Configuration Options

Builder Parameters

Parameter Type Default Description
path str Required Path to Android project
sdk str None SDK version or path
ndk str None NDK version or path
multidex bool False Enable multi-DEX
proguard bool False Enable ProGuard
proguardconfig dict None ProGuard configuration
sign bool True Sign the APK
signconfig dict None Signing configuration
buildtools str "34.0.0" Build tools version
target str "34" Target SDK version
minsdkversion int 21 Minimum SDK version
versioncode int 1 Version code
versionname str "1.0.0" Version name
aapt2 bool True Use AAPT2
optimize bool True Optimize APK
verbose bool False Verbose output
clean bool True Clean before build
java_home str None Path to java home
java_path str None Path to java
allow_missing_resources bool False Skips missing resources exception

Sign Configuration

signconfig = {
    'path': 'my-release.keystore',  # Path to keystore
    'alias': 'mykey',                # Key alias
    'password': 'mypassword',        # Key password
    'storepass': 'storepassword'     # Store password (optional)
}

ProGuard Configuration

proguardconfig = {
    'rules': ['proguard-rules.pro'],  # Rule files
    'optimize': True                   # Enable optimization
}

SDK/NDK Management

AndroBuilder automatically manages SDK and NDK installations:

Automatic Download

# Downloads SDK 34 automatically
builder = Builder(path="./MyApp", sdk="34")

# Downloads NDK 25.1.8937393 automatically
builder = Builder(path="./MyApp", sdk="34", ndk="25.1.8937393")

SDKs are installed in: <project>/.androbuilder/sdk/ NDKs are installed in: <project>/.androbuilder/ndk/

Using Existing SDK/NDK

# Use existing SDK
builder = Builder(path="./MyApp", sdk="/path/to/android-sdk")

# Use existing NDK
builder = Builder(path="./MyApp", ndk="/path/to/android-ndk")

SDK Detection

AndroBuilder automatically detects SDKs in:

  • $ANDROID_HOME
  • $ANDROID_SDK_ROOT
  • ~/Android/Sdk
  • ~/Library/Android/sdk
  • <project>/.androbuilder/sdk

Examples

Basic App

from androbuilder import Builder

builder = Builder(
    path="./HelloWorld",
    sdk="34",
    versionname="1.0.0",
    verbose=True
)

apk = builder.build("./output")

App with Native Code

from androbuilder import Builder

builder = Builder(
    path="./NativeApp",
    sdk="34",
    ndk="25.1.8937393",
    verbose=True
)

apk = builder.build("./output")

Release Build

from androbuilder import Builder

builder = Builder(
    path="./MyApp",
    sdk="34",
    proguard=True,
    proguardconfig={'rules': ['proguard-rules.pro']},
    sign=True,
    signconfig={
        'path': 'release.keystore',
        'alias': 'release',
        'password': 'release123'
    },
    versioncode=10,
    versionname="1.0.9",
    optimize=True
)

apk = builder.build("./release")

Large App with Multi-DEX

from androbuilder import Builder

builder = Builder(
    path="./LargeApp",
    sdk="34",
    multidex=True,
    minsdkversion=21,
    verbose=True
)

apk = builder.build("./output")

Error Handling

from androbuilder import Builder, BuildError, SDKError

try:
    builder = Builder(path="./MyApp", sdk="34")
    apk = builder.build("./output")
except SDKError as e:
    print(f"SDK error: {e}")
except BuildError as e:
    print(f"Build error: {e}")

Requirements

  • Python 3.7+
  • Java JDK 8+ (for javac and keytool)
  • Internet connection (for SDK/NDK downloads)

License

MIT License - see LICENSE file for details

Contributing

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

LICENSE (MIT)

MIT License

Copyright (c) 2025 Rustamov Humoyun Mirzo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Metadata

Release files for androbuilder 1.0.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 androbuilder 1.0.0
File Size Uploaded
androbuilder-1.0.0.tar.gz 19.0 kB Details

Built distribution (wheel)

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

Total release size: 37.7 kB

Release files / androbuilder-1.0.0.tar.gz

Download URL androbuilder-1.0.0.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
67338f4aea4f127f1f2f81cf8675e2ecca8bf2f6c3bfb72fe53387f26840dd86
BLAKE2b-256 checksum
How to use checksums
cafde6930afe170c8f43390d148ee97daaa8f51d951e54112defcb514f939619
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / androbuilder-1.0.0-py3-none-any.whl

Download URL androbuilder-1.0.0-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4424b2dc9d67b5d421df9a3fc7927b42b5aa7a1ee83f66d9c12570506130dd4
BLAKE2b-256 checksum
How to use checksums
19814d71a8dd57c76136b9df6382f5541eb88e706a0d40e3c9ca5f1e03831dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.0.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