nu_pos_react/src-tauri/gen/android/.
Commands
Run fromnu_pos_react/:
Prerequisites
1
Android SDK
Install Android Studio or the standalone SDK. Set
ANDROID_HOME and ensure platform-tools and build-tools are installed.2
NDK
Install the Android NDK via Android Studio SDK Manager. Required for compiling the Rust native library.
3
Rust Android targets
Add the Android compilation targets:
4
USB debugging
On the tablet, enable Developer Options (tap Build Number 7 times), then enable USB Debugging.
Content Security Policy
The CSP is defined insrc-tauri/tauri.conf.json under app.security.csp. Android WebView enforces CSP more strictly than desktop platforms.
Why bare wildcard is needed
The hub runs on the local network at a plain IP address (e.g.ws://10.0.20.63:8766). Per the CSP spec, http://* covers HTTP hosts but not WebSocket schemes. Adding ws://* and wss://* should work in theory, but Android WebView’s CSP implementation fails to match them against raw IP addresses. The bare * wildcard matches all schemes and hosts.
Cleartext traffic
Android 9+ blocks cleartext (non-TLS) network traffic by default. Since the hub usesws:// on the local network, cleartext must be explicitly allowed.
Two files control this:
- build.gradle.kts
- Network security config
In By default, Tauri only sets this to
src-tauri/gen/android/app/build.gradle.kts, the usesCleartextTraffic manifest placeholder must be "true" for both debug and release:"true" for debug builds. If your hub runs on ws:// (not wss://), you must change the default as well.Debugging
Chrome DevTools (recommended)
Inspect the Android WebView remotely using Chrome on your development machine.1
Enable devtools in Cargo.toml
Add the Without this, Chrome cannot see the WebView in release builds. Debug builds enable it automatically.
devtools feature to the Tauri dependency in src-tauri/Cargo.toml:2
Connect the device
Connect the Android tablet via USB with USB Debugging enabled.
3
Open Chrome inspector
Navigate to
chrome://inspect/#devices in Chrome on your Mac. The app’s WebView should appear in the remote devices list.4
Inspect
Click Inspect to open full DevTools: Console for JS errors, Network tab (filter by
WS for WebSocket), and DOM inspector.The
devtools Cargo feature increases the binary size slightly. You can remove it for production distribution once debugging is complete.