Command Overview
mkapk provides the following main commands:
| Command | Description | Usage |
|---|---|---|
init |
Initialize a new project | mkapk init |
build |
Build the project | mkapk build [options] |
clean |
Remove build artifacts | mkapk clean |
install |
Install a language plugin | mkapk install |
uninstall |
Remove a language plugin | mkapk uninstall |
help |
Show help information | mkapk help |
Detailed Commands
mkapk init
Initialize a new mkapk project with template structure.
What it does:
- Creates config.json with default settings
- Sets up directory structure (src, res, assets, bin)
- Generates AndroidManifest.xml template
- Creates sample Java class
mkapk build [options]
Build your Android application. This is the main command you'll use during development.
Build Options
| Flag | Description | Example |
|---|---|---|
-release |
Build for production (optimized, obfuscated) | mkapk build -release |
-all |
Force complete rebuild (ignore incremental cache) | mkapk build -all |
-arch <abi> |
Build for specific architecture | mkapk build -arch aarch64 |
-ndk-all |
Build universal APK + split per-architecture | mkapk build -ndk-all |
-no-obs |
Disable obfuscation (release builds only) | mkapk build -release -no-obs |
Build Examples
Debug build (default):
Creates a debug APK with symbols and no optimization.
Release build:
Creates an optimized, obfuscated APK ready for distribution.
Full rebuild:
Ignores cache and recompiles everything.
Multi-architecture:
Builds APKs for armv7, arm64, x86, x86_64, plus universal.
Specific architecture:
Builds only for 32-bit ARM devices.
Release without obfuscation:
Production build that keeps readable class/method names (debugging).
mkapk clean
Remove build artifacts while preserving keystores.
What it removes:
- Compiled classes and DEX files
- Generated APKs
- Native object files
- Build cache and temporary files
What it preserves:
- Keystores (.jks, .keystore files)
- Source code
- Configuration files
mkapk install <plugin.pl>
Install a language plugin (unsigned .pl package).
The plugin must be:
- A signed ZIP archive
- Contain plugin.json manifest
- Signed with valid cryptographic signature
mkapk uninstall <plugin_name>
Remove an installed language plugin.
mkapk help
Display help information and available commands.
Output Files
After building, you'll find these files in the bin/ directory:
| File | Purpose |
|---|---|
MyApp.debug.apk |
Debug build for development/testing |
MyApp.release.apk |
Release build for distribution |
MyApp-universal.apk |
Universal APK with all architectures (large file) |
MyApp-armv7.apk |
ARM 32-bit specific APK |
MyApp-arm64.apk |
ARM 64-bit specific APK |
MyApp-x86.apk |
x86 32-bit specific APK |
MyApp-x86_64.apk |
x86 64-bit specific APK |
Build Process Workflow
Change Detection
mkapk scans and hashes all source files to detect changes since last build.
Resource Compilation
AAPT2 compiles Android resources and generates R.java
Source Compilation
Javac compiles Java/Kotlin code → .class files
Native Compilation (if applicable)
Clang compiles C/C++ code → .so libraries (per-ABI)
DEX Conversion
D8/R8 converts .class files → classes.dex
APK Packaging
Zip assembles DEX, resources, native libraries → APK
Alignment & Signing
Zipalign optimizes layout, apksigner signs with keystore
Installation on Device
Using ADB
Direct Installation (from Termux)
Upgrade Existing App
Tips & Tricks
- Fast iteration: Use debug builds; incremental compilation speeds up rebuilds
- Test all ABIs: Before releasing, test on different device architectures
- Validate configuration: Check config.json for typos and correct paths
- Use smaller test apps: First builds take 124-150s; reduce project size for faster iteration
- Monitor storage: Builds can create large intermediate files; keep 1-5 GB free