Android模拟器emulator基本使用技巧和命令

android emulator 命令详解

 

在命令行输入: emulator -help,即可显示emulator支持的所有命令。

Android Emulator usage:

emulator [options] [-qemu args]


 

options:
    -sysdir <dir>                 在目录<dir>中搜索system.img
    -system <file>                读取system.img文件<file>   
    -datadir <dir>                写入用户数据到目录 <dir>
    -kernel <file>                使用指定内核kernel-qemu文件
    -ramdisk <file>               指定ram 镜像文件ramdisk.img
    -image <file>                  obsolete, use -system <file> instead
    -init-data <file>              initial data image (default <system>/userdata.img
    -initdata <file>               same as '-init-data <file>'
    -data <file>                   data image


                                   (default <datadir>/userdata-qemu.i mg
    -partition-size <size>         分区大小MBs
    -cache <file>                  cache.img
    -no-cache                      禁止缓存
    -nocache                       禁止缓存
    -sdcard <file>                 sdcard.img
    -wipe-data                     reset the use data image (copy it from initda ta)
    -avd <name>                    使用指定AVD设备
    -skindir <dir>                 search skins in <dir> (default <system>/skins )
    -skin <name>                   select a given skin
    -no-skin                       don't use any emulator skin
    -noskin                        same as -no-skin
    -memory <size>                 物理内存大小MBs
    -netspeed <speed>              最大网速
    -netdelay <delay>              网络延迟
    -netfast                       disable network shaping
    -trace <name>                  enable code profiling (F9 to start)
    -show-kernel                   显示内核消息
    -shell                         终端启用root shell
    -no-jni                        disable JNI checks in the Dalvik runtime
    -nojni                         same as -no-jni
    -logcat <tags>                 查看日志
    -no-audio                      disable audio support
    -noaudio                       same as -no-audio
    -audio <backend>               use specific audio backend
    -audio-in <backend>            use specific audio input backend
    -audio-out <backend>           use specific audio output backend
    -raw-keys                      disable Unicode keyboard reverse-mapping
    -radio <device>                无线猫
    -port <port>                   连接控制台的TCP端口.
    -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge

 

    -onion <image>                 use overlay PNG image over screen
    -onion-alpha <%age>            specify onion-skin translucency
    -onion-rotation 0|1|2|3        specify onion-skin rotation
    -scale <scale>                 窗口缩放
    -dpi-device <dpi>              specify device's resolution in dpi (default 1 65)
    -http-proxy <proxy>            HTTP/HTTPS 代理
    -timezone <timezone>           时区
    -dns-server <servers>          DNS服务器
    -cpu-delay <cpudelay>          throttle CPU emulation
    -no-boot-anim                  disable animation for faster boot
    -no-window                     disable graphical window display
    -version                       版本
    -report-console <socket>       report console port to remote socket
    -gps <device>                  redirect NMEA GPS to character device
    -keyset <name>                 specify keyset file name
    -shell-serial <device>         specific character device for root shell
    -old-system                    support old (pre 1.4) system images
    -tcpdump <file>                记录网络数据包
    -bootchart <timeout>           enable bootcharting
    -prop <name>=<value>           设置系统属性


     -qemu args...                 pass arguments to qemu
     -qemu -h                      显示qemu帮助

     -verbose                      same as '-debug-init'
     -debug <tags>                 enable/disable debug messages
     -debug-<tag>                  enable specific debug messages
     -debug-no-<tag>               disable specific debug messages

     -help                         帮助
     -help-<option>                print option-specific help

     -help-disk-images             about disk images
     -help-keys                    supported key bindings
     -help-debug-tags              debug tags for -debug <tags>
     -help-char-devices            character <device> specification
     -help-environment             environment variables
     -help-keyset-file             key bindings configuration file
     -help-virtual-device          virtual device management
     -help-sdk-images              about disk images when using the SDK
     -help-build-images            about disk images when building Android
     -help-all                     帮助(所有)

-

 

模拟器至少需要:
kernel-qemu
ramdisk.img
system.img
userdata.img

还可以包括:
sdcard.img
userdata-qemu.img
cache.img
system-qemu.img

----------------------------------------------------

http://www.lt163.com/jc/linux/diy/201201/7737_6.html


---------------------------------------------------------------------------------------

adb基本的命令教程

http://blog.csdn.net/xubin341719/article/details/7042249

1. 显示系统中全部Android平台:

    android list targets

2. 显示系统中全部AVD(模拟器):

    android list avd

3. 创建AVD(模拟器):

    android create avd --name 名称 --target 平台编号

4. 启动模拟器:

    emulator -avd 名称 -sdcard ~/名称.img (-skin 1280x800)

5. 删除AVD(模拟器):

    android delete avd --name 名称

6. 创建SDCard:

    mksdcard 1024M ~/名称.img

7. AVD(模拟器)所在位置:

    Linux(~/.android/avd)      Windows(C:\Documents and Settings\Administrator\.android\avd)

8. 启动DDMS:

    ddms

9. 显示当前运行的全部模拟器:

    adb devices

10. 对某一模拟器执行命令:

      abd -s 模拟器编号 命令

11. 安装应用程序:

      adb install -r 应用程序.apk

12. 获取模拟器中的文件:

      adb pull <remote> <local>

13. 向模拟器中写文件:

      adb push <local> <remote>

14. 进入模拟器的shell模式:

      adb shell

15. 启动SDK,文档,实例下载管理器:

      android

16. 缷载apk包:

      adb shell

      cd data/app

      rm apk包

      exit

      adb uninstall apk包的主包名

      adb install -r apk包

17. 查看adb命令帮助信息:

      adb help

18. 在命令行中查看LOG信息:

      adb logcat -s 标签名

19. adb shell后面跟的命令主要来自:

      源码\system\core\toolbox目录和源码\frameworks\base\cmds目录。

20. 删除系统应用:

      adb remount (重新挂载系统分区,使系统分区重新可写)。

      adb shell

      cd system/app

      rm *.apk

21. 获取管理员权限:

      adb root

22. 启动Activity:

      adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。

23、发布端口:

    你可以设置任意的端口号,做为主机向模拟器或设备的请求端口。如: 
adb forward tcp:5555 tcp:8000

24、复制文件:

    你可向一个设备或从一个设备中复制文件, 
     复制一个文件或目录到设备或模拟器上: 
  adb push <source> <destination></destination></source> 
      如:adb push test.txt /tmp/test.txt 
     从设备或模拟器上复制一个文件或目录: 
     adb pull <source> <destination></destination></source> 
     如:adb pull /addroid/lib/libwebcore.so .

25、搜索模拟器/设备的实例:

     取得当前运行的模拟器/设备的实例的列表及每个实例的状态: 
    adb devices

26、查看bug报告: 
adb bugreport 
27、记录无线通讯日志:

    一般来说,无线通讯的日志非常多,在运行时没必要去记录,但我们还是可以通过命令,设置记录: 
    adb shell 
    logcat -b radio

28、获取设备的ID和序列号:

     adb get-product 
     adb get-serialno

29、访问数据库SQLite3

     adb shell 
     sqlite3

#cd system/sd/data //进入系统内指定文件夹 
#ls //列表显示当前文件夹内容 
#rm -r xxx //删除名字为xxx的文件夹及其里面的所有文件 
#rm xxx //删除文件xxx 
#rmdir xxx //删除xxx的文件夹


  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值