-
Notifications
You must be signed in to change notification settings - Fork 0
Building APKs
ENPAF turns your project into a native Android APK using Gradle + Chaquopy. The build runs natively on Windows (and macOS/Linux) — no WSL or Docker.
- JDK 17–21 and the Android SDK — see Installation.
- Run
paf doctorto confirm both are detected.
paf build apk # debug build (auto-signed, installable)
paf build apk --release # release build (optimized + release-signed)
paf build apk --release --keystore mykeys.jks
paf build apk --clean # wipe the build dir first
paf build aab # Android App Bundle (implies release)The finished artifact is copied to dist/<name>-<version>.apk, where name
and version come from enpaf.json.
Install it:
adb install dist/myapp-1.0.0.apk…or use the Companion app + paf serve to install over Wi-Fi.
paf build apk |
paf build apk --release |
|
|---|---|---|
| Gradle task | assembleDebug |
assembleRelease |
| Signing | debug-signed | release-signed (see Release & Signing) |
| Optimization | none | release variant |
| Use for | quick testing | distribution |
Both produce an installable, signed APK — an unsigned release APK can't be installed, so ENPAF always signs release builds.
-
Validate the project (
enpaf.json,main.py,app/index.html). -
Check the environment — resolve a compatible JDK (pinning
JAVA_HOMEif the default Java is too new) and locate the Android SDK. -
Generate a complete Gradle/Chaquopy Android project into the build dir:
-
MainActivity(Java) hosting a WebView. - Your
app/copied toassets/www/. - The framework's Python modules + your
main.pyas Chaquopy sources. - A manifest from your
enpaf.json(permissions, features, deep links, icon). -
python_requirementswired into Chaquopy'spip { install ... }.
-
-
Run Gradle (
assembleDebug/assembleRelease). -
Copy the APK to
dist/.
Toolchain versions: Gradle 8.4, AGP 8.2, Chaquopy 15.0.1,
compileSdk 34 (defaults; min_sdk/target_sdk come from enpaf.json).
By default the Gradle project is generated in .enpaf_build/ inside your
project. If the project is under OneDrive, the build is relocated to
%LOCALAPPDATA%\enpaf\builds\<name>-<hash> to avoid OneDrive's file locks. The
APK is still copied back to your project's dist/.
Override the build location with ENPAF_BUILD_DIR:
$env:ENPAF_BUILD_DIR = "D:\enpaf-builds"
paf build apk --release- First build is slow (downloads Gradle + Android deps; Chaquopy assembles the Python runtime). Later builds reuse the cache.
- A code change only takes effect in a new APK — an already-installed APK won't pick it up until you rebuild and reinstall.
-
Bump
versioninenpaf.jsonfor updates.versionCodeis derived from it (major*10000 + minor*100 + patch); reinstalling the same version over an existing app is rejected by Android. See Troubleshooting. - Keep
build_config.minifyoff unless you've verified your Python/JNI deps survive R8 shrinking. - If a build fails, run
paf doctorand check JDK/SDK first; see Troubleshooting.
The framework's GitHub Actions build the Python distribution (wheel/sdist), not APKs — APK builds need the Android SDK + Chaquopy and are best run locally or on a dedicated runner. See Testing & CI.
Getting started
Reference
- CLI Reference
- enpaf.json Configuration
- Python API
- JavaScript Bridge
- Storage
- Events
- Device Capabilities
Building & shipping
Project