Tech Notes

Useful ADB (Android Debug Bridge) Commands

A quick reference for common adb commands: install and uninstall apps, filter logs by tag and broadcast an install referrer.

Here’s a quick note of some useful adb (Android Debug Bridge) commands. Bookmark it for quick reference.

Install a package (pass the path to your APK file)

adb install 
adb install com.phonegap.sarathdr

Uninstall a package (pass the package name)

adb shell pm uninstall 
adb shell pm uninstall com.phonegap.sarathdr

Filter logs by tag name

adb logcat -s "TAGNAME"

Broadcast a Google Play install referrer

You can use the commands below to broadcast a Google Play install referrer while testing during development.

First, open a shell on the device:

adb shell

Then run the following command from the adb shell:

am broadcast -a com.android.vending.INSTALL_REFERRER -n com.phonegap.sarathdr/.ReferralReceiver --es "referrer" "utm_source=twitter&utm_medium=medium&utm_term=term&utm_content=hi"

Note: the second adb install example should point to an APK file, for example adb install app-debug.apk; the package name is used only for uninstalling. Google Play has since replaced the INSTALL_REFERRER broadcast with the Play Install Referrer API.