Skip to content

Android Guide

Basic steps to build and run an Android project generated by pn.

What gets generated

pn run android unpacks the bundled Android template (Kotlin + Chaquopy) into build/android/android_template and copies your app/ into the template's app/src/main/python/app/.

No network is required for the template itself; the template zip is bundled with the package.

Run

pn run android

Or to only prepare the project without building:

pn run android --prepare-only

This will stage files under build/android/android_template so you can open it in Android Studio if you prefer.

Clean

Remove the build directory safely:

pn clean

Troubleshooting

  • If gradlew fails due to JDK path on macOS, ensure JAVA_HOME is set (the CLI attempts to detect Homebrew openjdk@17).
  • Ensure an Android emulator or device is available for installDebug.