I have spent a 2 days trying to set up a Cordova App and to run it in an android emulator following the instructions on this page (https://cordova.apache.org/docs/en/latest/guide/cli/index.html) and relating pages. I have encountered countless issues, the latest one being that the android emulator wont run. When I run:
我花了两天时间尝试设置Cordova应用程序并按照本页面上的说明在Android模拟器中运行它(https://cordova.apache.org/docs/en/latest/guide/cli/index。 html)和相关页面。我遇到了无数问题,最新的一个是android模拟器不会运行。当我跑:
cordova emulate android
I get the following message which just stays there:
我得到以下消息:
No emulator specified, defaulting to Nexus_5x_API_23_x86
Waiting for emulator.....
After searching for answers it seems I need to set up an Android Virtual Device (AVD). I have therefore started following these instructions (https://developer.android.com/studio/run/managing-avds.html) as told to do so by the Cordova instructions but I dont have the AVD Manager option available in my Android Studio.
在搜索答案后,我似乎需要设置Android虚拟设备(AVD)。因此,我已按照Cordova说明开始按照这些说明(https://developer.android.com/studio/run/managing-avds.html)进行操作,但我的Android Studio中没有AVD Manager选项。
I have the path to the SDK set up as shown below.
我有SDK设置的路径,如下所示。
Can anyone help with this? I am so fed up and confused by it all...
有人能帮忙吗?我很厌倦这一切......
***********UPDATE**************
*********** UPDATE **************
After the help below, I launched the AVD Manager from the Android SDK folder but came across the following error:
在下面的帮助之后,我从Android SDK文件夹启动了AVD Manager,但遇到了以下错误:
2 个解决方案
#1
3
Dont create the emulator in Android Studio. Instead create it with AVD Manager.exe
不要在Android Studio中创建模拟器。而是使用AVD Manager.exe创建它
I suppose you have an android SDK folder (appart from the one created by Android Studio). In that SDK folder, you'll have AVD Manager.exe Run the AVD Manager from there, create the virtual machine (emulator) and launch it. Then use the appropriate cordova command to launch the app (in the running emulator ; created as I suggested)
我想你有一个android SDK文件夹(来自Android Studio创建的appart)。在该SDK文件夹中,您将拥有AVD Manager.exe从那里运行AVD Manager,创建虚拟机(模拟器)并启动它。然后使用适当的cordova命令启动应用程序(在运行的模拟器中;按照我的建议创建)
In my case this is how the things work :
就我而言,这就是事情的运作方式:
Steps :
脚步 :
- I have downloaded android SDK package (for instance from here http://www.filehippo.com/download_android_sdk) and saved for instance at C:\Android_SDK
- 我已经下载了android SDK包(例如从这里http://www.filehippo.com/download_android_sdk)并保存在例如C:\ Android_SDK
- In that folder, you can download specific API level with
SDK Manager.exe
and create emulators withAVD Manager.exe
- 在该文件夹中,您可以使用SDK Manager.exe下载特定的API级别,并使用AVD Manager.exe创建模拟器
- Next create an emulator via
AVD Manager.exe
located where you saved the SDK package (here C:\Android_SDK) - 接下来通过位于保存SDK包的AVD Manager.exe创建模拟器(此处为C:\ Android_SDK)
- Launch (start) the emulator
- 启动(启动)模拟器
-
WHEN THE EMULATOR IS DONE LOADING, run
cordova build android
andcordova emulate android
(Don't forget to be in the working directory of your cordova project) - 当仿真器完成加载时,运行cordova build android和cordova模拟android(不要忘记在你的cordova项目的工作目录中)
- VOILA !!!
- VOILA !!!
#2
2
Looks like you're missing the whole "Android" option in the Tools subsection, so I would start by checking if the Menus and Toolbars to check if everything is ok. This is how it looks on my computer (it's the macOS version, but should be similar)
看起来你错过了工具子部分中的整个“Android”选项,所以我首先检查菜单和工具栏是否检查一切是否正常。这是它在我的电脑上的样子(它是macOS版本,但应该类似)
If you're missing that section, try "Adding after" the options you're missing. Anyway, you should be able to run the Android Virtual Device manager by running the AVD.exe command on the binary folder
如果您错过了该部分,请尝试“添加后”您缺少的选项。无论如何,您应该能够通过在二进制文件夹上运行AVD.exe命令来运行Android虚拟设备管理器
#1
3
Dont create the emulator in Android Studio. Instead create it with AVD Manager.exe
不要在Android Studio中创建模拟器。而是使用AVD Manager.exe创建它
I suppose you have an android SDK folder (appart from the one created by Android Studio). In that SDK folder, you'll have AVD Manager.exe Run the AVD Manager from there, create the virtual machine (emulator) and launch it. Then use the appropriate cordova command to launch the app (in the running emulator ; created as I suggested)
我想你有一个android SDK文件夹(来自Android Studio创建的appart)。在该SDK文件夹中,您将拥有AVD Manager.exe从那里运行AVD Manager,创建虚拟机(模拟器)并启动它。然后使用适当的cordova命令启动应用程序(在运行的模拟器中;按照我的建议创建)
In my case this is how the things work :
就我而言,这就是事情的运作方式:
Steps :
脚步 :
- I have downloaded android SDK package (for instance from here http://www.filehippo.com/download_android_sdk) and saved for instance at C:\Android_SDK
- 我已经下载了android SDK包(例如从这里http://www.filehippo.com/download_android_sdk)并保存在例如C:\ Android_SDK
- In that folder, you can download specific API level with
SDK Manager.exe
and create emulators withAVD Manager.exe
- 在该文件夹中,您可以使用SDK Manager.exe下载特定的API级别,并使用AVD Manager.exe创建模拟器
- Next create an emulator via
AVD Manager.exe
located where you saved the SDK package (here C:\Android_SDK) - 接下来通过位于保存SDK包的AVD Manager.exe创建模拟器(此处为C:\ Android_SDK)
- Launch (start) the emulator
- 启动(启动)模拟器
-
WHEN THE EMULATOR IS DONE LOADING, run
cordova build android
andcordova emulate android
(Don't forget to be in the working directory of your cordova project) - 当仿真器完成加载时,运行cordova build android和cordova模拟android(不要忘记在你的cordova项目的工作目录中)
- VOILA !!!
- VOILA !!!
#2
2
Looks like you're missing the whole "Android" option in the Tools subsection, so I would start by checking if the Menus and Toolbars to check if everything is ok. This is how it looks on my computer (it's the macOS version, but should be similar)
看起来你错过了工具子部分中的整个“Android”选项,所以我首先检查菜单和工具栏是否检查一切是否正常。这是它在我的电脑上的样子(它是macOS版本,但应该类似)
If you're missing that section, try "Adding after" the options you're missing. Anyway, you should be able to run the Android Virtual Device manager by running the AVD.exe command on the binary folder
如果您错过了该部分,请尝试“添加后”您缺少的选项。无论如何,您应该能够通过在二进制文件夹上运行AVD.exe命令来运行Android虚拟设备管理器