# Device setup and ADB automation ## Device prerequisites - exteraGram 12.5.1+. - In-app: Preferences → Plugins → enable the plugin engine, then enable developer mode. - USB debugging enabled, device authorized (`adb devices`). Release-build APKs disallow `adb run-as`, so you cannot `adb push` a file straight into the app's private plugin directory. The on-device **dev server** (`tools/devclient.py`, `scripts/deploy.sh`) is the actual install path — it talks to the running app over a TCP socket forwarded with `adb forward`, and the app writes the file into its own storage. ## ADB automation All scripts live in `scripts/`, are runnable from any working directory, and honor the standard `ANDROID_SERIAL` env var for device selection. - `scripts/adb-connect.sh [--debug]` — starts adb, waits for the device, (re)creates the `tcp:42690` port forward (and `tcp:5678` with `--debug`), pings the dev server. - `scripts/deploy.sh [--release] [--enable] [--no-connect]` — bundles, connects, writes the plugin to the device, optionally enables it, reloads it. - `scripts/watch.sh [deploy args…]` — watches `src/` and `plugin.json`, redeploys on change (uses `inotifywait` if available, otherwise polls). - `scripts/logs.sh [-c] [-t] [-g PATTERN]` — streams logcat for the running app (`-t` for the raw Chaquopy stdio tags, `-g` to grep, `-c` to clear first). - `scripts/debug.sh start|stop [--platform vscode|pycharm]` — forwards the debugger port and tells the dev server to start/stop the in-app debugger. Requires `debugpy` (vscode) or `pydevd-pycharm` (pycharm) present in the app's Python runtime — add it to `requirements` in `plugin.json` if it's missing. - `scripts/fetch-sdk-stubs.sh [--beta]` — downloads the latest SDK type stubs into `stubs/` for editor autocomplete.