A better shell for Android devices
Switch branches/tags
Clone or download
Pull request Compare This branch is 27 commits behind facebook:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
stub-arm-pic
stub-arm
stub-local
stub-x86-pic
stub-x86
.gitignore
LICENSE
Makefile.am
Makefile.am.fb-adb
Makefile.am.stub
Makefile.binary-releases
NEWS
PATENTS
README.lz4
README.md
adb.c
adb.h
adbenc.c
adbenc.h
androidmsg.c
androidmsg.h
ar-lib
argv.c
argv.h
arpy.py
autogen.sh
channel.c
channel.h
chat.c
chat.h
child.c
child.h
cmd.c
cmd.h
cmd_bash_completion.c
cmd_fcat.c
cmd_fget.c
cmd_finfo.c
cmd_fput.c
cmd_getprop.c
cmd_help.c
cmd_logcat_json.c
cmd_logwrite.c
cmd_ps_json.c
cmd_rdex.c
cmd_readlink.c
cmd_shex.c
cmd_shex_usage.txt
cmd_start_daemon.c
cmd_stop_daemon.c
cmd_stub.c
cmd_stub_package_hack.c
cmd_tar.c
cmdsproc.py
commands.xml
compile
config.guess
config.sub
configure.ac
constants.h
core.c
core.h
dbg.c
dbg.h
depcomp
elfid.c
elfid.h
errcodes.h
fb-adb.bashsrc.in
fb-adb.c
fdrecorder.c
fdrecorder.h
fixhtmldoc.sed
fs.c
fs.h
htmldoc.css.in
install-sh
json.c
json.h
lz4.c
lz4.h
missing
mk-fingerprint.py
mkstubsc.sh
net.c
net.h
peer.c
peer.h
proto.h
ringbuf.c
ringbuf.h
sha2.c
sha2.h
strutil.c
strutil.h
stub-config.sh
stubdaemon.c
stubdaemon.h
stubs.h
termbits.c
termbits.h
termnames.h.in
termnames.sed
timestamp.c.in
timestamp.h
utf8.c
utf8.h
util.c
util.h
valgrind.h
xenviron.c
xenviron.h
xfer.c
xfer.h
xmkraw.c
xmkraw.h

README.md

fb-adb is a tool for interacting with Android systems. It does much of what adb does, but with better remote shell support and, hopefully, fewer bugs. Differences between adb and fb-adb are that fb-adb:

  • is binary clean (no LF -> CRLF mangling)
  • transmits and updates window size
  • distinguishes standard output and standard error
  • properly muxes streams with independent flow control
  • allows for ssh-like pty allocation control
  • propagates program exit status instead of always exiting with status 0
  • properly escapes program arguments
  • kills remote program
  • provides a generic facility to elevate to root without re-escaping

DOWNLOADS

You can use Homebrew to install fb-adb binaries:

brew install fb-adb

BUILDING

An out-of-tree build is required. You'll need a copy of the Android NDK: tell configure about it by setting the ANDROID_NDK environment variable to your NDK path or by using the --with-android-ndk argument to the configure script.

For example:

./autogen.sh
export ANDROID_NDK=/path/to/android-ndk
mkdir build
cd build
../configure
make

If building on Mac, you need gmake to build. You can use Homebrew to get it:

brew tap homebrew/dupes
brew install homebrew/dupes/make

and then use gmake instead of make.

RUNNING

The fb-adb executable itself has no dependencies other than the adb executable, which must be on PATH. Generally, you can use fb-adb just like adb; fb-adb forwards unknown commands to adb. fb-adb supports the same device-selection options that adb does.

fb-adb shell is the fancy shell command that supports the features described above. Run fb-adb shell -h for additional options.

EXAMPLES

  • Capture a screenshot from device and write it locally to a timestamped file:

    fb-adb rcmd screencap -p > screenshot-$(timestamp).png

  • Dump database.db of the com.bar.foo app:

    fb-adb rcmd -u com.bar.foo sqlite3 /data/data/com.bar.foo/databases/database.db .d

  • Open remote shell as the user com.bar.foo:

    fb-adb shell -u com.bar.foo