[转]Handy adb commands for Android
转自:http://www.growingwiththeweb.com/2014/01/handy-adb-commands-for-android.html
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 # 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 screencap
and outputs it to a local directory using perl. Checkouthis 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
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
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
- DebugI
- InfoW
- WarningE
- ErrorF
- FatalS
- 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 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" #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
Further reading
See more details on the official adb
reference site.
[转]Handy adb commands for Android的更多相关文章
- 使用ADB无线连接Android真机进行调试
使用ADB无线连接Android真机进行调试 其实这已经是一个很古老的知识了,记录一下备忘. 准备工作 手机和电脑需要在同一个局域网内 电脑上已经安装好ADB工具,可以是Mac或者Windows ...
- 使用 adb logcat 显示 Android 日志
本文为转载. 地址:http://www.hanshuliang.com/?post=32 eclipse 自带的 LogCat 工具太垃圾了, 开始用 adb logcat 在终端查看日志; 1. ...
- (转载)Mac系统下利用ADB命令连接android手机并进行文件操作
Mac系统下利用ADB命令连接android手机并进行文件操作 标签: Mac adb android 2016-03-14 10:09 5470人阅读 评论(1) 收藏 举报 分类: Androi ...
- adb无线连接android手机进行调式,无需获得root权限
利用adb无线连接android手机进行调式 无需获得root权限 转载来自CSDN https://blog.csdn.net/lnking1992/article/details/5346518 ...
- Android之什么是Activity和常用的ADB命令以及Android项目结构的认识
总结一下之前学习Android的一些内容 一: Android常用的ADB命令(adb android调试桥) 1.adb devices 查看模拟器设备并重新连接. 2.adb ki ...
- windows下使用adb工具查看android程序cpu和内存消耗情况
在实际的开发当中,尤其软件运行在一个硬件设备比较差的环境下,对软件占用资源大的问题是开发者们必须要解决的问题,系统比较卡.觉得应该看看程序的cpu和内存消耗 一直以来都在windows下编程,已经习惯 ...
- 如何使用adb命令查看android中的数据库
1,进入到控制台中,输入adb shell,进入到命令模式的环境中 2,输入:cd /data/data/ 3, 选择你所在的数据库文件,比如我的com.android.homework, 输入命令: ...
- [置顶] 新修改ADB,支持Android 4.2 系统 ,全部中文命令,手机屏幕截图等等
发过好几个ADB的工具,有很多朋友用了之后给我反馈了不少的意见和bug,这里非常感谢他们,所以今天花了一天的时间重新整理了一下ADB,并且修改了这些BUG.也有朋友建议我给一个修改列表,今天发这个帖子 ...
- 【Android 应用开发】Android开发 使用 adb logcat 显示 Android 日志
作者 : 万境绝尘 转载请著名出处 eclipse 自带的 LogCat 工具太垃圾了, 开始用 adb logcat 在终端查看日志; 1. 解析 adb logcat 的帮助信息 在命令行中输入 ...
随机推荐
- Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. 试图加载格式不正确的程序。
出现上述问题的原因是,所加载的程序集中有32位的,也有64位的,IIS 7 程序池 在Windows下.Net FrameWork是64位的,要想正确使用,需要对程序池进行配置.如下图所示:
- paip.python php的未来预测以及它们的比较优缺点
paip.python php的未来预测以及它们的比较优缺点 跟个php比..python有下列的优点: 1.桌面gui 功能强大. 主要是pyqt很好...而ruby qt 则好像不更新了..php ...
- paip.消除 Java 的冗长try/catch/finally
paip.消除 Java 的冗长try/catch/finally 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blo ...
- 为什么说外卖O2O行业的未来在于尖端技术?
7月13日,百度公司董事长兼CEO李彦宏在发布会上谈及百度外卖时表示,百度外卖里有非常多的人工智能技术的应用,比如同样的商家订单,先配送后配送,时间路线规划等等,都有人工智能的技术,涉及机器学习的问题 ...
- iOS开发——高级技术&通讯录服务
通讯录服务 AddressBook iOS中带有一 个Contacts应用程序来管理联系人,但是有些时候我们希望自己的应用能够访问或者修改这些信息,这个时候就要用到 AddressBook.frame ...
- PHP类与面向对象(二)
构造函数和析构函数 构造函数PHP 5 允行开发者在一个类中定义一个方法作为构造函数.具有构造函数的类会在每次创建新对象时先调用此方法,所以非常适合在使用对象之前做一些初始化工作.如果子类中定义了构造 ...
- Arduino单片机使用和开发问题记录
1.将程序上传到板子时Arduino IDE提示“avrdude: stk500_getsync(): not in sync: resp=0x00” 网上查遇到这个问题的人比较多,有说驱动问题的,有 ...
- 分享45个设计师应该见到的新鲜的Web移动设备用户界面PSD套件
对于一个网页设计师来说做一个好的PSD模板是非常有挑战性的一项任务,虽然PSD的模板简化了设计任务,但找出高质量的PSD文件,可以自由使用,是一 项艰巨的任务.你必须通过许多网页去找出一个极少数的PS ...
- AngularJS中的http拦截
$http服务允许我们与服务端交互,有时候我们希望在发出请求之前以及收到响应之后做些事情.即http拦截. $httpProvider包含了一个interceptors的数组. 我们这样创建一个int ...
- html页面禁止自动填充浏览器记住的密码
现在的浏览器功能越来越强大,比如Chrome浏览器,在一个系统login的时候我们一般会记住密码,那么在整个系统中,浏览器一旦遇到 type="password"的控件,就会把密码 ...