On this page
To run adb sync, point the ANDROID_PRODUCT_OUT environment variable to your local build directory, remount your target partition as writable with adb remount, and run adb sync to copy only updated files to your device. When working with full developer tooling, our team at ScreenSync MCP integrates standard Android Debug Bridge commands alongside 226 Model Context Protocol tools to let AI assistants control and inspect live mobile environments.
Key Takeaways
- The
adb synccommand copies changed host files fromANDROID_PRODUCT_OUTto/system,/vendor, or/datapartitions on target hardware. - Target partitions require write permissions, which means practical use of traditional partition synchronisation requires root access or an unlocked engineering build.
- Standard screen capture requires neither root nor ADB when using the Android MediaProjection API, whereas automation commands like
control_taprely on ADB. - AI agents using the Model Context Protocol (MCP) can inspect state using
get_ui_hierarchyandget_latest_screenshotto make real-time debugging decisions without pushing raw system binaries.
What It Is and Why It Matters

What It Is and Why It Matters
The Purpose of Directory Synchronization in Android
The primary role of adb sync is to eliminate the overhead of manually pushing individual files via adb push during the Android platform development loop. Instead of transferring gigabytes of compiled system images, the command calculates file timestamps between the host computer and the target directories, transmitting only the binaries, libraries, or configurations that changed.
Where Traditional Synchronization Meets Its Limits
While partition syncing is efficient for developers maintaining Custom ROMs or Android Open Source Project (AOSP) builds, modern consumer devices lock system partitions. Pushing updates directly into /system or /vendor fails unless the bootloader is unlocked, ADB is operating in root mode, and verified boot is disabled. This restricts manual partition syncing largely to emulators and dedicated engineering hardware.
The Shift Toward Real-Time AI Agent Control
Modern QA workflows often need more than static directory synchronization; they require dynamic device synchronization where an AI assistant observes UI changes and triggers actions. By running a local hub that exposes tools through the Model Context Protocol (MCP), developers can pair traditional ADB commands with agent-driven automation without modifying protected system directories.
How It Works
The Environment Variable and Timestamp Comparison
The command relies strictly on the ANDROID_PRODUCT_OUT path defined on your development host. When you invoke adb sync [partition], ADB inspects the contents of that environment directory (which mirrors the device layout) and compares file modification times against the target directory on the Android device.
bash
export ANDROID_PRODUCT_OUT=/path/to/out/target/product/generic
adb sync system
If a file on the host has a newer timestamp, it is queued for transfer; identical or older files are skipped automatically to save bandwidth.
Root Requirements and Partition Access
Traditional Android system partitions mount as read-only (ro) by default. To synchronize updated system components, developers must execute adb root followed by adb remount. If the build is a production user build (user), adb root will fail, blocking write access to protected directories.
ADB Control vs Non-Root Screen Capture
Developer tasks generally divide into file or execution control and visual capture. Tools like control_tap, control_swipe, control_type, launch_app, and open_url require an ADB connection over USB or wireless debugging to dispatch input events. Conversely, real-time screen capture can bypass ADB and root entirely by relying on Android's native MediaProjection API, streaming the display directly over the local network.
| Option | Who It Suits | What Makes It Different |
|---|---|---|
| adb sync | AOSP & ROM builders | Pushes changed build files |
| adb push | Routine testing engineers | Targets single APKs or data files |
| ScreenSync MCP | AI agent automation developers | Bridges ADB control and non-root capture |
Step-by-Step Walkthrough
1. Setting Up the Local Host Environment
Before running synchronization commands, ensure your device has USB debugging enabled and is recognized by your machine. Define your target build path in your shell configuration to avoid command errors.
bash
Check connected devices
adb devices
Configure the build output variable
export ANDROID_PRODUCT_OUT=~/android/out/target/product/dev_board
2. Remounting Partitions for Writing
If you are flashing system modifications or updating platform packages, switch the daemon to root mode and remount the filesystem:
bash
adb root
adb remount
If you see a read-only file system warning, the underlying hardware lacks permission to remount without disabling verity (adb disable-verity), which requires a subsequent reboot.
3. Executing the Sync Command
Run the sync operation against a specific partition, or omit the argument to check all supported mount points:
bash
Sync only the system partition
adb sync system
Sync data partition files
adb sync data
Sync vendor updates
adb sync vendor
4. Integrating with Model Context Protocol Hubs
When integrating device synchronization with automated agents in Claude Desktop or Claude Code, configure your local hub to expose ADB input and capture tools. For Claude Code, set up the connection using stdio:
bash
claude mcp add screensync node "/path/to/hub/screensync-hub.js"
For Claude Desktop, declare the server inside claude_desktop_config.json under mcpServers:
{
"mcpServers": {
"screensync": {
"command": "node",
"args": ["/path/to/hub/screensync-hub.js"],
"env": {
"SCREEN_SYNC_TOKEN": "your_bearer_token_here"
}
}
}
}
The hub serves on HTTP port 3000, connects to the Android app (Android 7.0 or later) via a QR code or mDNS over the local network, and relays MCP over stdio to the desktop client.
| Component | Price | Included Features |
|---|---|---|
| Android App | Free on Google Play | MediaProjection screen streaming |
| Desktop Hub | Free download | Node.js hub, 29 phone tools |
| Browser Extension | Free download | MV3 real-tab control, 197 tools |
Example Prompts and Tool Calls
Inspecting Hierarchy After Synchronization
Once system binaries or user-facing apps are updated on the device, automated agents need to verify the interface. Instead of manual visual checks, an agent can query the node tree using get_ui_hierarchy to ensure expected view elements exist on screen. For an architectural deep dive, explore our guide on Android UI hierarchy vs computer vision.
Prompt example:
"Check the current screen layout to verify that the newly updated settings menu contains the developer toggle button."
Tool call emitted by the client:
{
"name": "get_ui_hierarchy",
"arguments": {}
}
Extracting Logcat Output to Validate Binary Execution
If a newly synchronized library fails to initialize, the agent can pull recent device logs to identify runtime exceptions directly through the get_logcat tool.
Prompt example:
"Pull the last 100 lines of system logs to check if the background service threw an exception during boot."
Tool call emitted by the client:
{
"name": "get_logcat",
"arguments": {
"lines": 100
}
}
Dispatching Touch Events to Verify Navigation
When testing interactive flows post-sync, the agent simulates real touch gestures using control_tap and control_swipe executed across the ADB connection.
Prompt example:
"Tap the confirmation button at coordinate x=540, y=1200 and wait for the screen to refresh."
Tool call emitted by the client:
{
"name": "control_tap",
"arguments": {
"x": 540,
"y": 1200
}
}
To discover how automated inputs handle complex flows on real devices, read about automated form filling and multi-step mobile flows without root.
Common Mistakes and Troubleshooting
Missing ANDROID_PRODUCT_OUT Environment Variable
A frequent failure occurs when running adb sync in a fresh terminal shell without initializing the Android build environment. The client will return adb: ANDROID_PRODUCT_OUT not set. Always source your build variables or assign the full target directory manually before executing the command.
Read-Only Filesystem Errors
Executing file synchronization against a standard consumer build produces adb: error: failed to copy: Read-only file system. This happens because production software mounts /system with verity checks enabled. If root is unavailable, bypass partition syncing entirely and push directly to user-accessible paths such as /data/local/tmp/ using adb push.
ADB Server Disconnects and Stale Daemons
High-frequency debugging can leave ADB server processes in an unresponsive state, resulting in device offline messages. Terminate and restart the bridge:
bash
adb kill-server
adb start-server
Ensure that only a single computer communicates with the device over wireless debugging or USB to prevent connection cycling.
MCP Tool Transport Limitations
When working with the Model Context Protocol, stdio clients like Claude Desktop, Claude Code, Cursor, and VS Code support local hub execution. However, remote interfaces like ChatGPT's web application demand remote HTTPS MCP endpoints, which our local stdio hub configuration does not support.
Diagnostic Checklist Before Modifying Devices
- Verify device authorization by checking that
adb devicesdoes not displayunauthorized. - Confirm write permissions by running
adb rootand checking if root access is granted on the build. - Check that
ANDROID_PRODUCT_OUTmatches the exact build architecture of the connected hardware. - If capturing visual state with ScreenSync MCP, ensure local network connectivity between the phone and the Node.js hub (HTTP port 3000).
- Verify that bearer token values configured in
claude_desktop_config.jsonmatch the token set in the running desktop hub.
Privacy and Safety Notes
On-Premises Screen Streaming
When using ScreenSync MCP, media frames captured through Android's MediaProjection API stream directly from your phone to your desktop hub over your local network. Live mirror latency averages about 94 ms median on a LAN in our tests. Frames are never routed through EpsolDev servers, and an optional Google Drive fallback is available if preferred.
Agent Data Transmissions
While video frames remain inside your local network, any specific visual snapshot requested by an AI agent (such as via get_latest_screenshot) is handed to the client interface and transmitted directly to that agent's model provider for inference. Sensitive personal data or production credentials should never be kept visible on screen during agent inspection.
Desktop Browser Approval Barriers
For hybrid testing that bridges mobile devices and real desktop tabs, the ScreenSync MCP browser extension (Manifest V3) introduces a human approval prompt for risky actions. This prevents autonomous agents from triggering unauthorized web actions while debugging across ecosystems.
Conclusion
For low-level platform engineers with rooted hardware, running adb sync is an effective method to push incremental partition builds without complete image reflashing. For developers and QA engineers automating modern mobile workflows, pairing ADB execution tools with non-root screen inspection via the Model Context Protocol provides a far more flexible, secure alternative.
ScreenSync MCP provides tools for developers looking to automate real devices, offering the ScreenSync MCP Android app, ScreenSync MCP hub, and ScreenSync MCP browser extension. You can learn more on our website at https://www.screensyncmcp.tech, contact our team at [email protected], or Get it on Google Play.
Questions, answered
What is the primary purpose of the adb sync command?
The adb sync command copies modified files from your host development build directory (ANDROID_PRODUCT_OUT) directly to device partitions like /system, /vendor, or /data. It avoids re-pushing identical files by inspecting file modification timestamps.
Why do I get a read-only filesystem error when running adb sync?
Standard consumer Android builds enforce read-only permissions on core system partitions. To write updates to these partitions using adb sync, your device must run an engineering or userdebug build that permits running adb root and adb remount.
What is the difference between adb push and adb sync?
The adb push command transmits designated files or directories to a specific path regardless of whether they have changed. In contrast, adb sync targets predefined partitions and only copies files with newer timestamps from the ANDROID_PRODUCT_OUT directory.
Does ScreenSync MCP require root permissions to automate Android?
No, ScreenSync MCP does not require root permissions. Screen capture operates through Android's native MediaProjection API without root and without ADB, while control actions like control_tap run through standard ADB over USB or wireless debugging.
Can I use ScreenSync MCP with the ChatGPT web app?
No, ScreenSync MCP works with MCP clients that run local stdio servers, such as Claude Desktop, Claude Code, Cursor, or VS Code. ChatGPT's web application requires remote HTTPS MCP endpoints, which are not supported.




