【Android】这些ADB常用命令你都知道么?
2016-12-27 16:14
423 查看
![](http://upload-images.jianshu.io/upload_images/727790-ccaf1bf315395d80.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
对于Android开发者而言,ADB命令是不可缺少的一部分。
下面让我们来看一些ADB常用的命令吧
显示系统中Android平台
android list targets
![](http://upload-images.jianshu.io/upload_images/727790-98dd8aaffe7a5897.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
安装APK程序之Install
adb install 应用程序.apk
![](http://upload-images.jianshu.io/upload_images/727790-1f65036900651944.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
安装APK程序之Push
adb pust <local> <remote>
![](http://upload-images.jianshu.io/upload_images/727790-f4c189e80bc7327d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以上的两种方法都可以安装APK但是他们有所不同,Adb Install是将APK安装到data/data目录下,作为普通的用户应用程序,而Adb Push则不是安装命令,它是将一个文件写入到手机存储系统。因此只要拥有响应的权限,只要拥有响应的权限,就可以把APK放到任意目录下面,甚至是放到system目录下面
向手机写入文件
adb pust <local> <remote>
![](http://upload-images.jianshu.io/upload_images/727790-d2864e08264378af.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
从手机获取文件
adb pull <remote> <local>
输出所有已经安装的应用
adb shell pm list packages -f
!adb shell pm list packages -f
查看系统盘符
adb shell df
![](http://upload-images.jianshu.io/upload_images/727790-ac3bdff245c14ef4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
查看Log
![](http://upload-images.jianshu.io/upload_images/727790-3822d3a3c331e5bf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
再自处可以使用 Linux 中的grep命令进行分组
![](http://upload-images.jianshu.io/upload_images/727790-624f1f5f43d05457.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
删除应用
adb remount//重新挂在系统分区,使系统分区重新可写
adb shell
cd system/app
rm ***.apk
这时候可能遇到下面的提示:
Not running as root. Try “adb root” first.
我们只需要照做就行了
![](http://upload-images.jianshu.io/upload_images/727790-b0812acca86c987c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
查看系统盘符
adb shell df
输出所有已经安装的应用
adb shell pm list packages -f
模拟键盘按键输入
adb shell input keyevent <code>
eg:
adb shell input keyevent 3
不知道怎么图片都上传不了了
code码可以上网上查,下面列出一些常用的code码吧:
code码 | 功能 |
---|---|
8 | menu |
3 | home |
19 | up |
20 | down |
21 | left |
22 | right |
66 | enter |
4 | back |
adb shell input touchscreen <x1> <y1> <x2> <y2>
ADB就像一根长长的纽带,手机在这头,电脑在那头。
end
我是大圣代,希望你能喜欢我的文章
相关文章推荐
- window下 android adb常用命令
- [Android]Android的常用adb命令
- Android adb 常用命令
- 在命令行中通过adb shell am broadcast发送广播通知以及Android的常用adb命令
- Android的常用adb命令
- android adb常用命令总结【安卓进化十】
- android adb常用命令
- [Android]Android的常用adb命令
- Android adb常用命令
- Android adb(Android Debug Bridge)常用命令
- Android adb 常用命令及需要注意的事项
- android adb 常用命令使用介绍 (【un】install push pull logcat devices remount shell monkey)
- Android-ADB常用命令
- Android adb的常用命令
- Android adb常用命令
- android的adb常用命令使用
- Android的常用adb命令
- android adb常用命令
- 一、android常用adb命令
- Android adb 常用命令 和 Trouble shooting问题