[英]How to run the Android Emulator with Cordova?
Prerequisite先决条件
How to reproduce :如何重现:
cordova build android
cordova build android
cordova emulate android --verbose
cordova emulate android --verbose
Expected result预期结果
The emulator is launched.模拟器启动。
Obtained result得到的结果
Command finished with error code 0: /Users/gamecube/Desktop/geocars/platforms/android/gradlew cdvBuildDebug,-b,/Users/gamecube/Desktop/geocars/platforms/android/build.gradle
Built the following apk(s):
/Users/gamecube/Desktop/geocars/platforms/android/app/build/outputs/apk/debug/app-debug.apk
No scripts found for hook "before_deploy".
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/gamecube/Library/Android/sdk (DEPRECATED)
Running command: adb devices
Command finished with error code 0: adb devices
Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
at /Users/gamecube/Desktop/geocars/platforms/android/cordova/lib/emulator.js:176:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
My questions我的问题
Why Android Emulator does not work?为什么 Android 模拟器不起作用?
and和
Why is there this error?为什么会出现这个错误? :
:
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
I solved my problem.我解决了我的问题。
How did I do it?我是怎么做的?
I then clicked on Apply (then OK on the pop-up) to download the package in question.然后我点击应用(然后在弹出窗口中确定)下载有问题的包。
I added the path of avdmanager to PATH in my .bash_profile我在 .bash_profile 中将 avdmanager 的路径添加到 PATH
I have run source ~ / .bash_profile
to refresh我已经运行
source ~ / .bash_profile
来刷新
And I launched my command: cordova emulate android --verbose
successfully since the emulator has opened well.我启动了我的命令:
cordova emulate android --verbose
成功,因为模拟器已经打开了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.