adbutil

A simple Javauto (cross platform) wrapper around Android Debug Bridge to enable multi device support.

Download


Introduction


Requirements


Available tasks


install

Pushes an Android application (specified as a full path to an .apk file) to an emulator/device.

java -jar adbutil.jar -task install -s all -a /home/evariste/apps/galois.apk
java -jar adbutil.jar -task install -s 2345frgty -a /home/evariste/apps/galois.apk
java -jar adbutil.jar -task install -s 2345frgty,Emulator-5554 -a /home/evariste/apps/galois.apk
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-a Path to the apk file

Available tasks


uninstall

Removes a package from the emulator/device.

java -jar adbutil.jar -task uninstall -s all -p com.pierre.fr
java -jar adbutil.jar -task uninstall -s 2345frgty -p com.pierre.fr
java -jar adbutil.jar -task uninstall -s 2345frgty,Emulator-5554 -p com.pierre.fr
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-p Package to delete

Available tasks


reboot

Reboot the emulator/device.

java -jar adbutil.jar -task reboot -s all
java -jar adbutil.jar -task reboot -s 2345frgty
java -jar adbutil.jar -task reboot -s 2345frgty,Emulator-5554
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]

Available tasks


startActivity

Start an activity.

java -jar adbutil.jar -task startActivity -s all -a com.riemann.gr/.Activity
java -jar adbutil.jar -task startActivity -s 2345frgty -a com.riemann.gr/.Activity
java -jar adbutil.jar -task startActivity -s 2345frgty,Emulator-5554 -a com.riemann.gr/.Activity
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-a Activity name

Available tasks


findPackage

Find a package on the emulator/device.

java -jar adbutil.jar -task findPackage -s all -p com.frobenius.gr
java -jar adbutil.jar -task findPackage -s 2345frgty -p com.frobenius.gr
java -jar adbutil.jar -task findPackage -s 2345frgty,Emulator-5554 -p com.frobenius.gr
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-p Package

Available tasks


getIP

Gets the emulator/device IP (wlan0).

java -jar adbutil.jar -task getIP -s all
java -jar adbutil.jar -task getIP -s 2345frgty
java -jar adbutil.jar -task getIP -s 2345frgty,Emulator-5554 
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]

Available tasks


getAPK

Gets the APK from the emulator/device given the app package.

java -jar adbutil.jar -task getAPK -s all -p com.massera.uy -f /home/evariste/apps/massera.apk
java -jar adbutil.jar -task getAPK -s 2345frgty -p com.massera.uy -f /home/evariste/apps/massera.apk
java -jar adbutil.jar -task getAPK -s 2345frgty,Emulator-5554 -p com.massera.uy -f /home/evariste/apps/massera.apk
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-p Package
-f Path to local APK destination

Available tasks


sendKeyEvent

Sends a KeyEvent to the emulator/device.

java -jar adbutil.jar -task sendKeyEvent -s all -e 3
java -jar adbutil.jar -task sendKeyEvent -s 2345frgty -e 26
java -jar adbutil.jar -task sendKeyEvent -s 2345frgty,Emulator-5554 -e 3
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-e KeyEvent code

Available tasks


screencap

Gets an emulator/device screenshot.

java -jar adbutil.jar -task screencap -s all -p /home/evariste/apps/screen
java -jar adbutil.jar -task screencap -s 2345frgty -p /home/evariste/apps/screen
java -jar adbutil.jar -task screencap -s 2345frgty,Emulator-5554 -p /home/evariste/apps/screen
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-p Path to local screenshot destination

Available tasks


wakeup

"Wake up" the emulator/device.

java -jar adbutil.jar -task wakeup -s all 
java -jar adbutil.jar -task wakeup -s 2345frgty 
java -jar adbutil.jar -task wakeup -s 2345frgty,Emulator-5554 
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]

Available tasks


clearPackage

Deletes all data associated with a given package (clearing app data, cache).

java -jar adbutil.jar -task clearPackage -s all -p com.barret.pa
java -jar adbutil.jar -task clearPackage -s 2345frgty -p com.barret.pa
java -jar adbutil.jar -task clearPackage -s 2345frgty,Emulator-5554 -p com.barret.pa
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-p Package

Available tasks


forceStopPackage

Force stop everything associated with package name.

java -jar adbutil.jar -task forceStopPackage -s all -p com.barret.pa
java -jar adbutil.jar -task forceStopPackage -s 2345frgty -p com.barret.pa
java -jar adbutil.jar -task forceStopPackage -s 2345frgty,Emulator-5554 -p com.barret.pa
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-p Package

Available tasks


directCommand

Executes a given adb command.

java -jar adbutil.jar -task directCommand -s all -c 'shell sendevent /dev/input/event2 3 0 x'
java -jar adbutil.jar -task directCommand -s 2345frgty -c 'shell input tap 18 31'
java -jar adbutil.jar -task directCommand -s 2345frgty,Emulator-5554 -c 'shell ls'
Parameters:
-s Device serial id. It can be: all, a serial id or a list of ids [separated with comma]
-c adb command to execute

Available tasks


deviceStatus

Generates a HTML report with all connected devices.

java -jar adbutil.jar -task deviceStatus -rp C:/my/path/to/report -rn MyReportName -t 20000
java -jar adbutil.jar -task deviceStatus -rp C:/my/path/to/report -rn MyReportName -t 20000
java -jar adbutil.jar -task deviceStatus -rp C:/my/path/to/report -rn MyReportName -t 20000
Parameters:
-rp Path of report without the last '/'
-rn Name of report without the file extension
-t Inserts a fixed delay between the report generation
Output:

Available tasks


Compiling From Source Guide

To prepare

There are a couple things you may need to install on your machine if you don't have them already:

To build

javauto adbutil.javauto

top


Contributing

  1. Create your feature branch (git checkout -b my-new-feature)
  2. Commit your changes (git commit -am 'Add some feature')
  3. Push to the branch (git push origin my-new-feature)
  4. Create new Pull Request

If you're looking to report a bug, please use the issue tracker in GitHub. Support can also be found that way.

top