简体   繁体   English

使用命令行运行android模拟器

[英]Run android emulator using command line

I am running latest version of Mac OS and I want to run android emulator through command line tool. 我正在运行最新版本的Mac OS,并且想通过命令行工具运行android模拟器。 I have run the following command on Mac terminal and got the following error. 我在Mac终端上运行了以下命令,并收到以下错误。

 $ emulator -list-avds
Pixel_XL_API_28

 $ emulator -avd Pixel_XL_API_28
PANIC: Missing emulator engine program for 'x86' CPU.

I also run the command with available options like below that is also available on official documentation developer.android.com 我还运行带有以下可用选项的命令,官方文档developer.android.com上也提供了以下选项

$ /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Pixel_XL_API_28 -netdelay none -netspeed full

What I need to do, so that I don't need to open android studios every time for only opening simulator. 我需要做的是,所以我不必每次只打开模拟器就打开android studio。

Please follow the steps in your terminal in Mac 请按照Mac中终端中的步骤进行操作

 Step 1 ( Add Environment Variable )
 export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
 export PATH=$PATH:$ANDROID_HOME/platform-tools
 export PATH=$PATH:$ANDROID_HOME/tools

 Step 2 ( .bash_profile / .bashrc ) 
 Reload you .bash_profile Or .bashrc depending on OS

 Step 3 ( go to emulator directory )
 cd /Users/$(whoami)/Library/Android/sdk/emulator

 Step 4 ( Get all list of Advs  )
 emulator -list-avds

 Step 5 ( Run your Emulator Command Mode )
 emulator -avd Nexus_5_API_22_Android_5.1

Take a look here : Android Emulator Error Message: "PANIC: Missing emulator engine program for 'x86' CPUS." 在这里看看: Android模拟器错误消息:“ PANIC:'x86'CPUS的缺少模拟器引擎程序。”

Then go as follows by cmd : 然后按cmd进行以下操作:

(the path to your emulators) - C:\\Users\\user\\AppData\\Local\\Android\\Sdk\\emulator> (仿真器的路径)-C:\\ Users \\ user \\ AppData \\ Local \\ Android \\ Sdk \\ emulator>

(the emulator name) - emulator.exe @Nexus_5 -dns-server 8.8.8.8 -writable-system (仿真器名称)-emulator.exe @ Nexus_5 -dns-server 8.8.8.8 -writable-system

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM