@klera/native-driver-android
v0.1.25
Published
In-app native DeviceDriver for Android — the preferred device-action path on Android (ADR-0028). Ships as an Expo Module auto-linked via its config plugin; apps that use Expo Go fall back to the engine's adb-backed driver automatically.
Downloads
3,035
Maintainers
Readme
@klera/native-driver-android
In-app native DeviceDriver for Android — the preferred device-action
path on Android (ADR-0028 A28-2). Ships as an Expo Module auto-linked
via its config plugin; apps that use Expo Go fall back to the engine's
adb-backed driver (ADR-0028 A28-7) automatically.
Status
A28-2 (this wave) is the package scaffold. Every method on the Kotlin
side currently throws mobile_e2e_not_implemented — the runtime
catches that and replies no_driver_linked, so the engine's adb
fallback kicks in for now.
Subsequent waves implement the real bodies:
- A28-3 — tap / type / scroll via
FabricUIManager - A28-4 — multi-touch (multiTap, pinch)
- A28-5 — screenshot via
PixelCopy+ frame capture (ADR-0026) - A28-6 — system UI (dismissAlert / dismissActionSheet /
dismissKeyboard) via
AccessibilityService, hardware back button, orientation, clipboard
Requirements
klera requires React Native's New Architecture (Bridgeless /
Fabric, default since RN 0.74) — see ADR-0036. The Kotlin module
targets the Fabric dispatch surface; no legacy UIManager path is
shipped.
Installing
npm install --save-dev @klera/native-driver-androidAdd the config plugin to your app.json:
{
"expo": {
"plugins": ["@klera/native-driver-android"]
}
}Then prebuild and rebuild the Android project:
npx expo prebuild --platform android
npm run androidWiring
Pass KleraDriver to RuntimeClient alongside the usual
provider and dispatcher:
import { RuntimeClient } from "@klera/runtime";
import { KleraDriver } from "@klera/native-driver-android";
const client = new RuntimeClient({
url: "ws://10.0.2.2:7345",
info: { runtimeVersion: "1.0.0", platform: "android", appId: "com.example.app" },
provider,
dispatcher,
deviceDriver: KleraDriver,
});(Note: 10.0.2.2 is the Android emulator's loopback alias for the
host's 127.0.0.1. On a physical device, point the URL at the host
machine's LAN IP and ensure both are on the same network.)
Dev-only
Keep the package in devDependencies so production builds never
link the Kotlin module. Some methods will reach for internal RN
APIs (FabricUIManager event injection) that are not safe for
release builds. Same constraint as @klera/native-driver-ios.
Behaviour when unlinked
If the native module is not linked (Expo Go, iOS build, production
build that skipped the autolink), requireNativeModule throws at
call time. The runtime catches this and replies to the bridge with
no_driver_linked, which the engine's composite driver interprets
as "fall back to adb" (ADR-0028 A28-7 + A28-9). No flow changes
required — the same YAML runs against the same engine regardless of
which driver answered.
