Monday, September 29, 2014

How to use ADB command on android

ADB (Android Debug Bridge) is a special feature of android which allows us to communicate with android device that connected to computer through USB cable.

Basically we can do a lot of cool stuff with ADB command, such as install apk from computer to the device or get apk from installed apps on the device to computer.

Learning ADB command is a must, not only for developer but also normal users like us which enjoy doing cool stuff and maximizing our android device.

Before you can use/run/execute ADB command on your android device, you must have the ADB program itself on the computer.

To get ADB program, normally you can install android SDK, so if you have android SDK inside your computer then you already have the program.

There's another way to get ADB program inside your computer, you can download the program from here, or try the installer like this one.

To use run ADB command, you must first enable USB debugging mode on your device and then plug it to the computer and make sure the computer could recognize the device.

After that you can go ahead run ADB command from command prompt (console), the most common thing you do to test whether the device really connected is to run this command :

adb devices

That command will shows all devices currently connected to the computer, remember you need to turn on USB debugging mode on the device, otherwise this won't work.
 


Here's list of adb command that you can play with.

Command What for
adb devices show list of android devices
adb shell run linux command line on your device
adb help show help
adb version show adb version
adb logcat show log data on your device, to stop press CTRL + C
adb bugreport showing dumpsys, dumpstate, and logcat, to stop press CTRL + C
adb jdwp show JDWP (java debug wire protocol)
adb install <path-to-apk> install apk to your device
adb pull <remote> <local> download specified file on your device to the computer
adb push <local> <remote> upload specified file on your computer to the device
adb get-serialno show serial number of your device
adb get-state show the state of your device
adb wait-for-device wait until the device ready (combine this with other command)
adb start-server start the adb server
adb kill-server stop the adb server

Now i want you try these commands and see what happen in your device :

adb shell am start -a android.intent.action.VIEW
adb shell am start -a android.intent.action.MAIN
adb shell am start -a android.intent.action.DIAL
adb shell am start -a android.intent.action.EDIT
adb shell am start -a android.intent.action.PICK
adb shell am start -a android.intent.action.SEARCH
adb shell am start -a android.intent.action.CHOOSER

Have fun with ADB commands :)

No comments:

Post a Comment