有没有一种方法可以在不启动Android Studio的情况下运行模拟器。也许是从命令行。我知道这个功能在旧版本中是可用的,但从那以后就消失了。但也许有人已经知道怎么做了?
当前回答
- For Linux Ubuntu
从终端as创建一个新文件
gedit模拟器.sh(使用任何名称的文件在这里,我已经使用“模拟器”)
现在在这个文件中写入以下行
cd / home / Android Sdk /工具/用户名
./模拟器@你创建的Android设备名称
(在@后面写上你的AVD的名字
。/模拟器@Nexus_5X_API_27 )
现在保存文件并使用以下命令运行模拟器
。/ emulator.sh
在上述命令之前的命令被拒绝使用的情况下
CHMOD +X emulator.sh
准备就绪,开始。
其他回答
试试这个
1. 完整的视频教程(适用于所有windows版本)
OR
2. 文本教程
Open the command prompt and change the directory where your sdk is placed D:\Softwares\Android\sdk\tools\bin> now add your avdmanager in this,now your full code is D:\Softwares\Android\sdk\tools\bin>avdmanager list avd it will show you a list of emulator device that you have already created after few seconds now typecd.. and run your emulator with this cmd, Here my emulator name is Tablet_API_25 so I have typed this name after the -avd. D:\Softwares\Android\sdk\tools>emulator -avd Tablet_API_25
编辑:对于Android Studio 3.2或更高版本,路径更改为D:\Softwares\Android\sdk\emulator\emulator -avd Tablet_API_25
例如:%ANDROID_HOME%\tools\emulator -avd [AVD NAME]
在MacOS
首先列出已安装的模拟器
~/Library/Android/sdk/tools/emulator -list-avds
然后运行模拟器
~/Library/Android/sdk/tools/emulator -avd Nexus_5X_API_27
列出您拥有的模拟器
~/Library/Android/sdk/tools/emulator -list-avds
例如,我有这个Nexus_5X_API_24
运行模拟器的命令是
cd ~/Library/Android/Sdk/tools && ./emulator -avd Nexus_5X_API_24
只需创建一个.bat文件。叫它smth,比如run pixel 2.bat 用notepad++这样的编辑器打开它 写2行代码
cd C:\Users\mxsof\AppData\Local\Android\Sdk\emulator
emulator -avd pixel_2_api_29
启动它。
这是所有。编码快乐!
让它在Windows 10上工作:
C:\Users\UserName\AppData\Local\Android\Sdk\tools>emulator -list-avds
Nexus_5X_API_28
C:\Users\UserName\AppData\Local\Android\Sdk\emulator>emulator -avd Nexus_5X_API_28