Connect Your Phone
Before DroidBot can automate your phone, you need to enable USB debugging and authorize your computer. This takes about 2 minutes.
Step 1: Enable Developer Options
Section titled “Step 1: Enable Developer Options”- Open Settings on your Android phone
- Scroll to About Phone (on Samsung: Settings > About Phone > Software Information)
- Tap Build Number 7 times rapidly
- You should see a toast message: “You are now a developer!”
- Go back to Settings — a new Developer Options menu should appear
Step 2: Enable USB Debugging
Section titled “Step 2: Enable USB Debugging”- Open Settings > Developer Options
- Toggle USB Debugging to ON
- Confirm any security prompts
Step 3: Connect and Authorize
Section titled “Step 3: Connect and Authorize”Plug your phone into your computer with a data-capable USB cable (not a charge-only cable).
adb devicesExpected output:
List of devices attachedL9AIB7603188953 deviceIf you see unauthorized instead of device, check your phone screen — there should be a popup asking “Allow USB debugging?”. Tap Allow and check “Always allow from this computer”.
Step 4: Verify the Connection
Section titled “Step 4: Verify the Connection”# Check screen resolutionadb shell wm size# Physical size: 1080x2340
# Verify UI hierarchy is readableadb shell uiautomator dump /sdcard/tt.xml && adb exec-out cat /sdcard/tt.xml | head -c 200# Should output XML content starting with <?xml
# Quick Python testpython3 -c "from marketing_system.bots.common.adb import Devicedev = Device()print('Connected to:', dev.serial)xml = dev.dump_xml()print(f'Screen has {len(dev.nodes(xml))} UI elements')"Multiple Devices
Section titled “Multiple Devices”If you have more than one phone connected, specify which device to use:
# List all connected devicesadb devices# L9AIB7603188953 device# RZCX125RE5L device
# Target a specific deviceexport DEVICE=L9AIB7603188953
# Or pass per-commandDEVICE=RZCX125RE5L python3 run.pyWithout the DEVICE variable, ADB commands will fail with “more than one device/emulator” errors.
Troubleshooting
Section titled “Troubleshooting””no devices/emulators found”
Section titled “”no devices/emulators found””- Check the USB cable. Charge-only cables do not support data transfer. Try a different cable.
- Check USB mode. Some phones default to “Charging only” — change to “File transfer” (MTP) in the USB notification.
- Restart ADB:
Terminal window adb kill-server && adb start-server && adb devices - Try a different USB port. Avoid USB hubs during initial setup.
- Linux udev rules. You may need to add your user to the
plugdevgroup:Terminal window sudo usermod -aG plugdev $USER# Log out and back in
“unauthorized”
Section titled ““unauthorized””Your phone is showing a USB debugging authorization prompt that you haven’t accepted yet.
- Check the phone screen for the popup
- Tap Allow
- Check Always allow from this computer to avoid this in the future
- Run
adb devicesagain
”device offline”
Section titled “”device offline””adb kill-server && adb start-serverIf still offline, unplug and replug the USB cable. Some phones need USB mode explicitly set to “File transfer”.
“uiautomator dump failed”
Section titled ““uiautomator dump failed””UIAutomator can fail when:
- Screen is locked — wake it first:
adb shell input keyevent KEYCODE_WAKEUP - App uses custom rendering (Flutter, games) — UIAutomator cannot see custom-drawn elements
- Another UIAutomator instance is running — only one can run at a time
- System under load — wait 2 seconds and retry
Samsung-Specific Notes
Section titled “Samsung-Specific Notes”Samsung phones return <node ...>...</node> instead of self-closing <node ... /> tags. The Device class parser handles this automatically. If you see XML parsing errors on Samsung devices, ensure you are using the latest version of adb.py.
Verified Devices
Section titled “Verified Devices”| Device | Serial | Screen | Status |
|---|---|---|---|
| ASUS ROG Phone II | L9AIB7603188953 | 1080x2340 | Primary, fully tested |
| Samsung Galaxy A15 | RZCX125RE5L | 1080x2340 | Secondary, tested |
The system works with any Android 5.0+ device that supports USB debugging. Higher-end devices perform better due to faster XML dump times.
Next Steps
Section titled “Next Steps”- Hello World — run your first automation
- Phone Farm Guide — set up multiple devices