美文网首页
使用命令启动android emulator

使用命令启动android emulator

作者: zwebbin | 来源:发表于2018-07-31 10:44 被阅读0次

    本文教程是在Mac系统下,Windows其实也可以通过类似的方法达到目的。

    脚本文件执行

    创建一个脚本文件,写好了脚本,需要添加可执行权限:

    chmod +x file_name
    

    添加权限以后,通过命令行来执行脚本:

    ./file_name
    

    如果要使脚本在任何路径下都可以执行,需要将脚本文件放到这个路径:

    /usr/local/bin/
    

    放完脚本以后,在任何路径下输入脚本文件名,就可以成功执行脚本:

    file_name (按下enter)
    

    使用命令行运行Android SDK自带的模拟器 android emulator

    首先确认SDK的路径,比如我SDK的路径是:

    ~/Library/Android/sdk
    

    使用SDK下的emulator工具,查看已创建的 模拟器
    如果你配置了环境变量,可以直接输入

    $ emulator -list-avds
    NexusAPI_27
    Nexus_5X_android_P
    

    或者带绝对路径输入:

    ~/Library/Android/sdk/tools/emulator -list-avds
    

    然后启动名为NexusAPI_27的模拟器:

    ~/Library/Android/sdk/tools/emulator -avd NexusAPI_27
    

    高级选项:

    emulator -avd device_id [options]
    

    冷启动模拟器 cold boot,不保存关机前的状态:

    -no-snapshot-load performs a cold boot, and saves the emulator state on exit.
    -no-snapshot disables the Quick Boot feature completely—it does not load or save the emulator state. [source]


    查看默认jdk安装路径:

     /usr/libexec/java_home -V
    

    结果:

    Matching Java Virtual Machines (1):
        1.8.0_131, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
    
    /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
    

    相关文章

      网友评论

          本文标题:使用命令启动android emulator

          本文链接:https://www.haomeiwen.com/subject/enpcvftx.html