#android #adb #bridge #tokio

adb-client-tokio

A Rust library for communicating with Android devices via the Android Debug Bridge (ADB) protocol

8 releases

new 0.0.8 Nov 18, 2024
0.0.7 Nov 18, 2024
0.0.5 Jun 13, 2024

#291 in Debugging

MIT license

36KB
723 lines

Crates.io Docs.rs Build License: MIT

Android Debug Bridge (ADB) Client Library for async Rust

A pure rust implementation to send commands and forwards traffic to an android device using a adb server.

Complete Example

Run a shell command on an device:

use adb_client_tokio::{Device, AdbClient};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut adb = AdbClient::connect_tcp("127.0.0.1:5037").await.unwrap();
    let version = adb.shell(Device::Default, "getprop ro.product.model").await?;
    println!("ADB server version: {}", version);
Ok(())
}

Protocol Details

Checkout Android Source for details about the used protocols

Development

To inspect adb traffic you can e.g. use SOCAT like this:
socat -x -v TCP-LISTEN:8080,fork TCP:127.0.0.1:5037

Dependencies

~6–14MB
~163K SLoC