使用命令行运行android模拟器

使用命令行运行android模拟器

本文介绍了使用命令行运行android模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行最新版本的Mac OS,并且我想通过命令行工具运行android模拟器.我已经在Mac终端上运行了以下命令,并收到了以下错误消息.

I am running latest version of Mac OS and I want to run android emulator through command line tool. I have run the following command on Mac terminal and got the following error.

 $ emulator -list-avds
Pixel_XL_API_28

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

我还运行带有以下可用选项的命令,该选项在官方文档中也可用developer.android.com

I also run the command with available options like below that is also available on official documentation developer.android.com

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

我需要做的是,所以我不必每次只打开模拟器就打开android studios.

What I need to do, so that I don't need to open android studios every time for only opening simulator.

推荐答案

请在Mac终端中按照步骤操作

Please follow the steps in your terminal in 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

这篇关于使用命令行运行android模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 01:21