adb 命令大全

来源:互联网 发布:域名删除时间到了 编辑:程序博客网 时间:2024/05/22 19:46

一、adb常用命令

   为了能在任意目录使用一下命令,需要将SDK目录下的platform-tools文件夹路径和tools文件夹路径配置到path环境变量中

   1.列出可以使用的android版本

     android list targets

   2.列出可以使用的虚拟机

     android list avd

   3.创建虚拟机

     android create avd –n <虚拟机名> -t <Target版本ID> -c <SD卡大小> -s <屏幕尺寸>

   4.启动虚拟机

     emulator –avd <虚拟机名>

   5.显示已连接的设备

     adb devices

   6.导入文件到手机

     adb push <Windows源文件路径> <手机目标路径>

   7.从手机导出文件

     adb pull <手机源文件路径> <Windows目录路径>

   8.安装程序

     adb install <apk文件路径>

   9.卸载程序

     adb uninstall <包名>

   10.重启adb(连接的调试桥的socket出现了错误 时)

     adb kill-server

     abd start-server


二、数据库操作

   1.获取模拟器/设备列表

   adb devices

   2.指定device来执行adb shell

     adb -s decivesname shell

    如:adb –s emulator-5554 shell

   3.shell命令记住两个基本命令lscd,类似windows命令提示行中的dircd,代表列出当前目录下文件列表和进入到指定目录。了解这两个命令之后,就可以找到data/data/项目包名/databases,找到数据库文件,接下来就是使用sqlite管理工具来进行操作了。键入sqlite3数据库名就进入了sqlite管理模式了。


三、monkey测试

   1.获取模拟器/设备列表

   adb devices

   2.指定device来执行adb shell

     adb -s decivesname shell

    如:adb –s emulator-5554 shell

   3.进入shell后执行相关的monkey命令

     如:monkey -help  获取帮助

     如:monkey -p 指定包名 -v 100







0 0