我在Mac上,在终端上进行Android开发。我已经成功地创建了HelloWorld项目,现在我试图从Android模拟器中的命令行运行它。哪个命令运行HelloWorld项目的模拟器?

我已经有Android工具和平台工具在我的路径。

编辑:

如何告诉模拟器从命令行运行HelloWorld项目?我已经用ant构建了这个项目。


当前回答

在windows中,我使用这个PowerShell脚本来启动它。

$em = $env:USERPROFILE+"\AppData\Local\Android\sdk\tools\emulator.exe"; 
Start-Process $em " -avd Nexus_5X_API_24" -WindowStyle Hidden;

其他回答

打开CMD

打开命令提示符 在我的例子中输入模拟器的路径

C: \ adt - bundle - windows - x86_64 - 20140702 \ \ sdk工具

在我的例子中写“emulator -avd emulatorname”

-avd阿迪vd模拟器

列出所有模拟器:

emulator -list-avds

运行一个带-avd标志的模拟器:

emulator -avd name-of-your-emulator

模拟器可执行文件在下面:

${ANDROID_SDK}/tools/emulator

或者,对于更新的sdk,尝试:

cd ${ANDROID_HOME}/emulator
emulator -avd name-of-your-emulator

(Linux) 在你的终端复制粘贴和改变三个蓝色的字段

/home/YouUser/Folder/adt-bundle-linux-x86_64-20140702/sdk/tools/emulator64-x86 -avd Android5.1.1

YouUser = user of session in linux
Folder = path of folfer
Android5.1.1 = You version of android in the emulator,for example (Android4.4.2)

你可以在你的文件夹home中查看模拟器 cd /home/Youuser/.android/avd/

上可用的avd名称列表

android - avd。 SDK_PATH/工具/ emuls / netdelay no -netspeed full -avd “AVD_NAME”

如果你有Git Bash,你可以双击打开模拟器,进行一些初始设置(仅在Windows 10中测试):

Open Git Bash. Run cd ~/AppData/Local/Android/sdk/emulator Run ./emulator -list-avds and keep note of the emulator's name. MY_EMULATOR for example. Open Notepad and add these two lines (insert your emulator's name instead of MY_EMULATOR): cd ~/AppData/Local/Android/sdk/emulator; ./emulator -avd MY_EMULATOR Save the file somewhere convinient as myfile.sh. You can change "myfile" as suits you best, but the extension .sh is needed. Open Git Bash at the directory where you stored myfile.sh and run chmod +x myfile.sh. Remember to put your file's name instead of myfile.

就是这样!从现在开始,每次你需要启动模拟器,只要找到你的myfile.sh,双击它,等待你的Android模拟器启动!