English | 中文
Auto Fish is an Android device control service with a deterministic CLI client (af).
If you want to build from source (APK or CLI), prepare:
- JDK 17
- Android SDK (with
adb) - Rust toolchain (
cargo) just
Recommended environment:
ANDROID_HOMEpoints to your Android SDK path
Install the APK, open the app, then do the following:
- Enable accessibility permission for Auto Fish.
- In Home page, turn on Service.
- Note the service connection info shown in app:
- Device IP
- Port
- Token
just build
just installThen follow the same 3 steps above.
Build from source:
cd cli
cargo build --releaseSet environment variables (replace with your actual values):
export AF_URL="http://<DEVICE_IP>:<PORT>"
export AF_TOKEN="<TOKEN>"
export AF_DB="./af.db"Run first commands:
./target/release/af health
./target/release/af observe top
./target/release/af observe screen --max-rows 80 --fields id,text,desc,resId,flags
./target/release/af observe refs --max-rows 80
./target/release/af act tap --x 540 --y 1200
./target/release/af act tap --by text --value "Settings"af observe screenshot --annotate --max-marks 120
af act swipe 100,1200,900,1200 --duration 300
af act tap --by resid --value "com.android.settings:id/title" --exact-match
af observe refs --max-rows 120
af act tap --by ref --value @n3
af verify text-contains --text "Settings"
af verify node-exists --by text --value "Settings"
af recover back --times 2Notes:
--urlis required unlessAF_URLis set.--tokenis required for protected commands unlessAF_TOKENis set.- Command output is JSON (single line per command).
just check
just build
cd cli && cargo testMore docs: