[英]Ionic Emulate Android Error - Exit Code 2
I'm running into trouble trying to run我在跑步时遇到了麻烦
ionic emulate android
I get an error which says Error: android: Command failed with exit code 2
.我收到一条错误消息,内容为Error: android: Command failed with exit code 2
。 But, it does say BUILD SUCCESSFUL
.但是,它确实说BUILD SUCCESSFUL
。
What I'm running我在跑什么
I have set up environment variables in my .bashrc:我已经在我的 .bashrc 中设置了环境变量:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Here is the the bottom of the output for ionic emulate android
这是ionic emulate android
输出的底部
UP-TO-DATE
BUILD SUCCESSFUL
Total time: 1.206 secs
Built the following apk(s): /home/matts-pc/Desktop/turn-app/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=/home/matts-pc/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Error: android: Command failed with exit code 2`
enter code here
Here is the output when I run cordova run --list
这是我运行cordova run --list
时的输出
Available android devices:
Available android virtual devices:
ERROR: Error: android: Command failed with exit code 2
An unexpected error has occured while running list-emulator-images with code 2: Error: /home/matts-pc/Desktop/turn-app/platforms/android/cordova/lib/list-emulator-images: Command failed with exit code 2
Let me know if you need anything else!需要帮助请叫我! Thank you谢谢
Got an answer from this post !从这篇文章中得到了答案!
Inside platforms/android/cordova/lib/emulator.js
:在platforms/android/cordova/lib/emulator.js
:
Change:改变:
return superspawn.spawn('android', ['list', 'avds'])
To:到:
return superspawn.spawn('android', ['list', 'avd'])
Change:改变:
var command = 'adb -s ' + target + ' install -r "' + apk + '"';
To:到:
var command = 'adb uninstall "' + pkgName + '"; adb -s ' + target + ' install -r "' + apk + '"';
All credit to the original poster所有功劳归功于原始海报
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.