Build a sample APK
requires Android SDK/NDK + buildozergit clone https://github.com/PyDevices/pydevices-android-template.git
cd pydevices-android-template
./build_android.sh # prompts for launcher title
./build_android.sh -y # keep current title (CI)
./build_android.sh --title Paint
# APK under p4a_app/bin/
./scripts/emulator.sh
Runtime / SDL (from p4a_app)
same Runtime idiom as desktop PyDevices apps
board_config
pydevices-desktop supplies neutral display and input endpoints; an application opts into a traffic controller when needed.
import board_config
import eventsys
display_drv = board_config.display_drv
runtime = eventsys.Runtime.from_board_config(board_config)
paint handlers
From p4a_app/paint.py — register events, then run forever.
from board_config import display_drv
from app_runtime import runtime
runtime.on(runtime.events.MOUSEBUTTONDOWN, handler)
runtime.on(runtime.events.MOUSEMOTION, on_motion)
runtime.run_forever()
Gallery vs APK
two different delivery paths — do not conflatePyScript Gallery
Runs in Chrome (or as an installed web app). MicroPython or Pyodide in the browser — no APK, no Android SDK. Ideal for quick tryouts of the same examples.
Native Android
This repo. CPython inside a python-for-android APK with SDL2, usdl2, and TestPyPI wheels. Install with adb or the emulator script — not via the browser gallery.
Customize
clone and replace the sample appp4a_app/
Sample application: board_config.py, paint.py, main.py, and buildozer.spec (package id org.pydevices.p4a_app). Swap in your own application to ship it.
p4a_recipes/
Namespaced recipes for the pydevices-* TestPyPI distributions, plus pydeviceslvgl for the native pydevices-lvgl wheel. Core package versions are pinned; the LVGL recipe selects a compatible native wheel.