Handy adb commands for Androi
来源:互联网 发布:2016网络流行名字大全 编辑:程序博客网 时间:2024/05/16 08:58
View connected device(s)
Use this to view all connected devices and list their IDs.
adb devices
If multiple devices are attached, use adb -s DEVICE_ID
to target a specific device.
Install an application
Use the install
command to install an apk, the optional -r
argument reinstalls and keeps any data if the application is already installed on the device.
adb install -r APK_FILE# exampleadb install -r com.growingwiththeweb.example
Uninstall an application
adb uninstall PACKAGE_NAME# exampleadb uninstall com.growingwiththeweb.example
Start an activity
adb shell am start PACKAGE_NAME/ACTIVITY_IN_PACKAGEadb shell am start PACKAGE_NAME/FULLY_QUALIFIED_ACTIVITY# exampleadb shell am start -n com.growingwiththeweb.example/.MainActivityadb 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 with shell screencap
and 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
Unlock screen
This command sends the event that unlocks the lockscreen on the device.
adb shell input keyevent 82
Logging
To show the log stream on your command line.
adb logcat
Filter by tagname
adb logcat -s TAG_NAMEadb logcat -s TAG_NAME_1 TAG_NAME_2#exampleadb logcat -s TESTadb logcat -s TEST MYAPP
Filter by priority
To show logs of a specific priority warning and above.
adb logcat "*:PRIORITY"# exampleadb logcat "*:W"
Here are the priority levels:
V
- Verbose (lowest priority)D
- DebugI
- InfoW
- WarningE
- ErrorF
- FatalS
- Silent (highest priority, on which nothing is ever printed)
Filter by tagname and priority
adb logcat -s TAG_NAME:PRIORITYadb logcat -s TAG_NAME_1:PRIORITY TAG_NAME_2:PRIORITY#exampleadb logcat -s TEST: W
Filter using grep
Alternatively the output of logcat
can be piped to grep
on a system that supports it.
adb logcat | grep "SEARCH_TERM"adb logcat | grep "SEARCH_TERM_1\|SEARCH_TERM_2"#exampleadb 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
Further reading
See more details on the official adb
reference site.
- Handy adb commands for Androi
- Handy adb commands for Android
- Handy adb commands for Android
- ADB commands
- adb commands
- ADB--commands
- HANDY ONE-LINERS FOR SED
- Ubuntu下配置Androi ADB
- Using the Windows Debugger: Some Handy/Fun/Clever Debugger Commands
- adb shell commands
- ADB Commands Cheat Sheet
- Handy Tips for Working with Excel 2003
- Handy Notes for 2013 Beijing Perl Workshop
- HANDY ONE-LINERS FOR SED 英文原版
- Android ALSA relevant adb commands
- androi
- DDL Commands for LOBs
- some commands for search
- 朱清时——物理学步入禅境:缘起性空-(技术工作者上升到哲学思维)
- c++基础
- Struts2中的模块包含
- linux下安装oracle后重启无法登录数据库ORA-01034:ORACLE not available的解决方案
- Stack ---- Implementation in C and Python
- Handy adb commands for Androi
- 2014/03/03
- 一、初探Linux之系统结构篇
- 网络编程--回调函数 阻塞操作 异步执行
- 《黑客与画家》摘要
- IOS中四种json解析效率比较
- GDI+实现的图片相互转换程序,可以通过命令行参数来调用
- Word Break
- apache tika技术了解