Adb Usage at Work


To use adb in archlinux, first install android-tools.

sudo pacman -S android-tools

I then add the adb resources to the android rules files. To do this, first do lsusb, you'll get something like this:

Bus 001 Device 004: ID 12d1:256b Huawei Technologies Co., Ltd.

To add this to the rules, open up /etc/udev/rules.d/51-android.rules And add this:

SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0660", GROUP="plugdev"

To list all the packages installed:

adb shell pm list packages -f

To get the main activity of a package

adb shell pm dump | grep -A 1 MAIN

To launch activities

#launches the launcher activity
adb shell monkey -p -c android.intent.category.LAUNCHER 1


adb shell am start -n

To start a specific action

am start -a com.example.ACTION_NAME -n

To install apk

#if not previously installed
adb install filename.apk
#if it had been installed eg. when upgrading
adb install -r filename.apk