Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Android phone. ADB is bundled with Android SDK package that can be downloaded from Android SDK download page. This tool is usefull for communicating with Android phone such as install application, copy files from/to device and perform some linux shell commands.
Download and install Java SDK (Ex:jdk-6u20-windows-i586.exe)
Download Android SDK package (Ex:android-sdk_r06-windows.zip)
Extract SDK package into anywhere on your drive (Ex: D:\android-sdk-windows)
Phone Setup
In order to use ADB, you have to enable USB Debugging option in phone settings (Settings->Applications->Development)
New Android SDK puts adb executable file on \platform-tools directory instead of tool. So the path should be D:\android-sdk-windows\platform-tools
1. Check connected phone
Syntax: adb devices
2. Login to Android shell
Syntax: adb shell
Note:
If you get ‘#’ after typing adb shell, you are already get root access on the phone, no need to type su. Otherwise if you get ‘$’ , type ‘su’ to get root access (only for rooted device).
3. Some usefull shell commands
Syntax: ls [path]
Example:
#ls /system/lib
Syntax: cp [options] source dest
Note:
To copy or delete files in Android root directories you have to change the directory access mode to ‘read and write (rw)’ using command: remount rw
Example:
#remount rw
#cp /sdcard/libsec-ril.so /system/lib
#remount ro
Syntax: mv [options] source dest
Example:
#mv /system/lib/libsec-ril.so /sdcard/backup
Syntax: chmod [-R] mode[,mode] …. file
Example:
#chmod 0644 /system/lib/libsec-ril.so
Syntax: rm [options] file
Example:
#rm /system/lib/libsec-ril.so
4. Install application
You can use adb to install aplication from your local drive into phone.
Syntax: adb install appname.apk
Example:
D:\android-sdk-windows\tools\adb install D:\AnReboot.apk
5. Copy files from phone to local drive
Syntax: adb pull source [destination]
Example:
D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip
D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip D:
6. Copy files from local drive to phone
Syntax: adb push source destination
Example:
D:\android-sdk-windows\tools\adb push D:\AnReboot.apk /sdcard
To See The Original Link Please Click Here
获取序列号:
adb get-serialno
查看连接计算机的设备:
adb devices
重启机器:
adb reboot
重启到bootloader,即刷机模式:
adb reboot bootloader
重启到recovery,即恢复模式:
adb reboot recovery
查看log:
adb logcat
终止adb服务进程:
adb kill-server
重启adb服务进程:
adb start-server
获取机器MAC地址:
adb shell cat /sys/class/net/wlan0/address
获取CPU序列号:
adb shell cat /proc/cpuinfo
adb install //比如:adb install baidu.apk
adb install -r //比如:adb install -r baidu.apk
adb install -s // 比如:adb install -s baidu.apk
adb uninstall //比如:adb uninstall com.baidu.search
adb uninstall -k //比如:adb uninstall -k com.baidu.search
adb shell am start -n /.
adb shell top
adb shell top -m 6
adb shell top -n 1
adb shell procrank
adb shell kill [pid]
adb shell ps
adb shell ps -x [PID]
adb shell service list
adb shell cat /proc/meminfo
adb shell cat /proc/iomem
adb remount
adb push
adb pull
adb shell ls
adb shell cd
adb shell rename path/oldfilename path/newfilename
adb shell rm /system/avi.apk
adb shell rm -r
adb shell mv path/file newpath/file
adb shell chmod 777 /system/fonts/DroidSansFallback.ttf
adb shell mkdir path/foldelname
adb shell cat
adb shell cat /data/misc/wifi/*.conf
adb logcat -c
adb bugreport
adb shell cat /system/build.prop
adb help
adb shell monkey -v -p your.package.name 500