adb常用命令总结
lddarran90
8年前
<h2>adb命令中用于确定目标设备的参数</h2> <ul> <li>-d 目标设备是唯一连接到adb的真机</li> <li>-e 目标设备是唯一连接到adb的模拟器</li> <li>-s <specific divice> 指定adb命令的目标设备</li> </ul> <h2>常用命令:</h2> <ul> <li><strong>文件相关:</strong></li> </ul> <table> <thead> <tr> <th>命令</th> <th>功能</th> </tr> </thead> <tbody> <tr> <td>adb shell screenrecord <file path></td> <td>录屏,需要停止时按Ctrl+C,默认录制时长180秒</td> </tr> <tr> <td>adb shell screencap <file path></td> <td>截屏</td> </tr> <tr> <td>adb shell cat <file path></td> <td>查看文件内容</td> </tr> <tr> <td>adb pull <remote path> <local path></td> <td>从手机导出文件</td> </tr> <tr> <td>adb push <local path> <remote path></td> <td>导入文件到手机</td> </tr> </tbody> </table> <ul> <li><strong>应用调试:</strong></li> </ul> <table> <thead> <tr> <th>命令</th> <th>功能</th> </tr> </thead> <tbody> <tr> <td>adb tcpip 5555<br> adb connect <device IP></td> <td>开启无线调试</td> </tr> <tr> <td>adb install -r <apk file path></td> <td>安装程序,保留原程序数据</td> </tr> <tr> <td>adb uninstall -k <package name></td> <td>卸载程序,保留数据</td> </tr> <tr> <td>adb shell clear <package></td> <td>清除应用缓存</td> </tr> <tr> <td>adb shell dumpsys activity | findstr "mFocusedActivity"</td> <td>查看上层activity</td> </tr> <tr> <td>adb shell am start -n <package name>/<activity in package></td> <td>开启一个actiivty</td> </tr> <tr> <td>adb shell am force-stop <package name></td> <td>强制停止程序</td> </tr> <tr> <td>adb shell input keyevent 4</td> <td>adb模拟返回按键</td> </tr> </tbody> </table> <p> </p> <p>来自:http://www.jianshu.com/p/ccdfd0ec2b3a</p> <p> </p>