WEB开发网
开发学院手机开发Android 开发 Android adb的常用命令 阅读

Android adb的常用命令

 2012-12-27 13:36:18 来源:WEB开发网   
核心提示: 1.查询有几个android设备连接adb server>adb devicesList of devices attached0123456789ABCDEF device2.安装某个apk到android设备中>adb install -r B:\test\6577\PinyinIME.

 1.查询有几个android设备连接adb server
>adb devices
List of devices attached
0123456789ABCDEF device
2.安装某个apk到android设备中
>adb install -r B:\test\6577\PinyinIME.apk
2509 KB/s (1284852 bytes in 0.499s)
pkg: /data/local/tmp/PinyinIME.apk
Success
-r 表示强制安装,当系统中原本有这个apk时加上这个选项可保证安装了新的apk。
3.从本地复制文件到设备
>adb push B:\test\6577\PinyinIME.apk /data/app
3491 KB/s (1284852 bytes in 0.359s)
4.从设备复制文件到本地
>adb pull /data/app ./
pull: building file list...
pull: /data/app/com.android.inputmethod.pinyin-2.apk -> ./com.android.inputmethod.pinyin-2.apk
pull: /data/app/PinyinIME.apk -> ./PinyinIME.apk
pull: /data/app/com.google.android.inputmethod.pinyin-1.apk -> ./com.google.android.inputmethod.pinyin-1.apk
3 files pulled. 0 files skipped.
4766 KB/s (10981224 bytes in 2.249s)
这个命令的意思是把设备中/data/app目录下的所有的apk复制到本地的当前目录下。
5.进入shell
这样,你就可以像在 linux 下面敲命令了。
>adb shell
root@android:/ # logcat
6.重启adb server
>adb kill-server
>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
这些命令真的是经常用到的,一定要记住哦~
adb还有很多的用法,可以用adb help。
>adb help
Android Debug Bridge version 1.0.26


-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <serial number> - directs command to the USB device or emulator with
the given serial number. Overrides ANDROID_SERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must

1 2 3  下一页

Tags:Android adb 常用

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接