Skip to content

Android Debug Bridge

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device (an emulator or a connected Android device).

adb is included in the Android SDK Platform-Tools package. You can download this package with the SDK Manager, which installs it at android_sdk/platform-tools/. Or if you want the standalone Android SDK Platform-Tools package, you can download it here.

If you are new to adb, we recommend this tutorial on how to use it here.

Useful ADB commands

We have made a list of the most common adb commands that will help with your Famoco project.

Famoco ID

adb shell getprop ro.serialno

DEVICE MODEL

adb shell getprop ro.product.model

IMAGE VERSION

adb shell getprop ro.build.display.id

ANDROID VERSION

adb shell getprop ro.build.version.release

IMEI 1

adb shell dumpsys iphonesubinfo

IMEI 2

adb shell dumpsys iphonesubinfo2

DEVICE SCREEN SIZE

adb shell dumpsys window | grep DisplayWidth

SEE IP ADDRESS

adb shell ifconfig tiwlan0

OPEN ANDROID SETTINGS

adb shell am start -n com.android.settings/com.android.settings.Setting>

Famoco APPS

adb shell ps | grep famoco

CLEAR APP DATA

adb shell pm clear PACKAGE_NAME

INSTALL APK

adb install -r APK_FILE

UNINSTALL APP

adb uninstall PACKAGE_NAME

LIST PERMISSIONS KNOWN TO THE SYSTEM

adb shell pm list permissions -f

LIST INSTALLED PACKAGES

adb shell pm list packages -f

FILTER LOGS FOR ERRORS

adb logcat *:E

CREATE LOG FILE WITH JUST THE ERROR

adb logcat *:E > errorLog.txt

SEE THE APN LIST

adb shell cat /etc/apns-conf.xml

OPEN THE ACTIVITY TO INPUT NEW APN

adb shell am start -a android.intent.action.INSERT  content://telcarriers  --ei simId -1

SEE THE NAME OF THE CURRENT ACTIVITY

adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'

TAKE A SCREEN SHOT

adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png

GET VERSION CODE

adb shell dumpsys package com.systemonenoc.avatarapp | grep versionCode

adb shell pm dump com.systemonenoc.avatarapp | grep -i code

DISABLE AUTO LAUNCH

adb shell am start com.famoco.settings/.SettingsActivity

Example

UNINSTALL APP

To uninstall applications on Famoco devices:

  • Find the “package name” of the application you want to uninstall by running aapt: aapt dump badging apk_file
  • Uninstall the application: adb uninstall package_name

Method

To uninstall the APP “Loyalty”.

  • Find the “package name” of “Loyalty” by running aapt dump badging loyalty-debug.apk

aapt_package_name

  • Uninstall “Loyalty”: adb uninstall com.famoco.loyalty

Uninstall

A complete list of ADB commands can be found at adventuresinqa.com

Source: developer.android.com