国外的开发者对于adb调试的总结(英语很好懂,不翻译了)
2014-05-16 12:14
387 查看
View connected device(s)
Use this to view all connected devices and list their IDs.adb devicesIf multiple devices are attached, use
adb -s DEVICE_IDto target a specific device.
Install an application
Use theinstallcommand to install an apk, the optional
-rargument reinstalls and keeps any data if the application is already installed on the device.
adb install -r APK_FILE # example adb install -r ~/application.apk
Uninstall an application
adb uninstall PACKAGE_NAME # example adb uninstall com.growingwiththeweb.example
Start an activity
adb shell am start PACKAGE_NAME/ACTIVITY_IN_PACKAGE adb shell am start PACKAGE_NAME/FULLY_QUALIFIED_ACTIVITY # example adb shell am start -n com.growingwiththeweb.example/.MainActivity adb shell am start -n com.growingwiththeweb.example/com.growingwiththeweb.example.MainActivity
Entering the device’s shell
adb shell
Take a screenshot
Sergei Shvetsov came up with a nice one liner that takes a screenshot withshell screencapand outputs it to a local directory using perl. Checkout his blog for an explanation.
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
Power button
This command sends the power button event to turn the device on or off.adb shell input keyevent 26
Unlock screen
This command sends the event that unlocks the lockscreen on the device. It can be combine with the power button command above to turn on and unlock the device.adb shell input keyevent 82
Print all installed packages
adb shell pm list packages -f
Logging
To show the log stream on your command line.adb logcat
Filter by tagname
adb logcat -s TAG_NAME adb logcat -s TAG_NAME_1 TAG_NAME_2 #example adb logcat -s TEST adb logcat -s TEST MYAPP
Filter by priority
To show logs of a specific priority warning and above.adb logcat "*:PRIORITY" # example adb logcat "*:W"Here are the priority levels:
V- Verbose (lowest priority)
D- Debug
I- Info
W- Warning
E- Error
F- Fatal
S- Silent (highest priority, on which nothing is ever printed)
Filter by tagname and priority
adb logcat -s TAG_NAME:PRIORITY adb logcat -s TAG_NAME_1:PRIORITY TAG_NAME_2:PRIORITY #example adb logcat -s TEST: W
Filter using grep
Alternatively the output of logcatcan be piped to
grepon a system that supports it.
adb logcat | grep "SEARCH_TERM" adb logcat | grep "SEARCH_TERM_1\|SEARCH_TERM_2" #example adb logcat | grep "Exception" adb logcat | grep "Exception\|Error"
Clearing the logcat
buffer
Use this to clear the buffer to remove any old log data.adb logcat -c
下面是中文翻译版:下面是一些我搜集的一些Android ADB(Android Debug Bridge)命令,在手动或自动构建和测试过程中它们非常好用。
查看已连接的设备
使用此命令查看所有的连接设备,并列出它们的ID:adb -s DEVICE_ID来指定特定的设备。
安装应用
使用install命令来安装apk,如果设备上已经安装了应用,可以使用可选参数
-r重新进行安装并保留所有数据。
卸载应用
启动Activity
进入设备的命令行
日志
用来在命令行中显示日志流:grep的系统中,
logcat输出可以通过管道发送给
grep:
相关文章推荐
- 国外开发者对于Flex Framework的总结
- Android 调试桥官方文档翻译(adb)
- 英语对于软件开发者来说到底有多重要?
- 开发者想要什么---算是我的翻译作品的处女作吧,呵呵,致力于英语学习..
- 英语翻译方法总结1
- [翻译&摘抄] 在 Chrome 开发者工具中调试 Node.js
- Android Studio ADB网络调试总结
- 英语对于软件开发者来说到底有多重要?
- 关于iOS开发者账号功能总结-真机调试(二)
- 关于iOS开发者账号功能总结-真机调试(一)
- LuaJavaBridge - Lua 与 Java 互操作的简单解决方案(对于QUICK-COCOS开发者是很好的文章)
- 常用英语翻译与技巧总结
- 推荐一款安卓开发者无线调试用的APP Wi-ADB
- 盘点完了国外的了,现在我们谈谈国内的吧,这个对于英语没有什么要求
- 国外开发者总结:欧美顶级游戏坑钱指南
- 不得不说的谷歌开发者模式:谷歌调试模式调试js代码总结
- [痛并快乐着 国外开发者总结欧美游戏坑钱指南] 讀後感想
- android adb 调试总结
- Android系统移植与调试之------->如何添加一个adb wifi无线调试的功能【开发者选项】-【Wifi调试】