[英]'Error: the command “android” failed' using cordova
I'm trying to get the android platform added on cordova. 我正在尝试在cordova上添加android平台。 I've added and downloaded the most recent SDK in Android SDK, my path is : export PATH=${PATH}:/Users/xxx/Development/android-sdk-macosx/platform-tools:Users/xxx/Development/android-sdk-macosx/tools
, but I keep getting the following error: 我已经添加并下载了Android SDK中最新的SDK,我的路径是: export PATH=${PATH}:/Users/xxx/Development/android-sdk-macosx/platform-tools:Users/xxx/Development/android-sdk-macosx/tools
,但我不断收到以下错误:
Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.
at /Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:808:24)
at /Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:752:41)
at /Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:574:44
at flush (/Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: /Users/xxx/.cordova/lib/android/cordova/3.5.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
What am I doing wrong? 我究竟做错了什么? I've search all over for answers, but nothing seems to work. 我到处都在寻找答案,但似乎没有任何效果。 Thanks in advance! 提前致谢!
In case of Apache Cordova with Android Studio 0.8 for Mac OS X 10.9, if you have installed in the default /Applications folder, run this on Terminal 如果使用适用于Mac OS X 10.9的Android Studio 0.8的Apache Cordova ,则如果已安装在默认的/ Applications文件夹中,请在终端上运行
export ANDROID_HOME="/Applications/Android Studio.app/sdk"
export ANDROID_TOOLS="/Applications/Android Studio.app/sdk/tools/"
export ANDROID_PLATFORM_TOOLS="/Applications/Android Studio.app/sdk/platform-tools/"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
To confirm, run echo and get 要确认,请运行echo并获取
echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Android Studio.app/sdk:/Applications/Android Studio.app/sdk/tools/:/Applications/Android Studio.app/sdk/platform-tools/
For Cordova 3.6, it threw another error on a fresh Android Studio 对于Cordova 3.6,它在全新的Android Studio上引发了另一个错误
Error: Please install Android target "android-19"
To resolve this, open SDK manager in the IDE, and download the mentioned android version (android-19) 要解决此问题,请在IDE中打开SDK管理器,然后下载提到的android版本(android-19)
the android
command is part of the android sdk's tools package. android
命令是android sdk工具包的一部分。 Both android
and adb
are used by the Cordova tools to work their magic and both need to be put on the path. Cordova工具使用android
和adb
来发挥其魔力,并且两者都需要放在路径上。
They are located in the following directories: 它们位于以下目录中:
path/to/android/sdk/tools
path/to/android/sdk/platform-tools
I don't know what OS you are developing on. 我不知道您正在开发什么操作系统。 The process for modifying the path is different on windows and unix based systems 在Windows和基于UNIX的系统上,修改路径的过程有所不同
On my system (OSX) this is done by adding the following lines to .bash_profile
: 在我的系统(OSX)上,这是通过向.bash_profile
添加以下行来完成的:
PATH=$PATH:/Users/lorenzo/dev/sdks/adt-bundle/sdk/tools
PATH=$PATH:/Users/lorenzo/dev/sdks/adt-bundle/sdk/platform-tools
this could also be done in a single line: 这也可以在一行中完成:
PATH=$PATH:/Users/lorenzo/dev/sdks/adt-bundle/sdk/tools:/Users/lorenzo/dev/sdks/adt-bundle/sdk/platform-tools
this appends the path strings to the global PATH variable. 这会将路径字符串附加到全局PATH变量。 On unix the path delimiter is ':' 在Unix上,路径分隔符为':'
much the same process, here is the official docs: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653%28v=vs.85%29.aspx 大致相同的过程,这是官方文档: http : //msdn.microsoft.com/zh-cn/library/windows/desktop/ms682653%28v=vs.85%29.aspx
After your path is setup, you will need to run the android
tool and install additional tools and android platforms (versions). 设置路径后,您将需要运行android
工具并安装其他工具和android平台(版本)。
Your system will need Apache ANT and the java run time as well. 您的系统将需要Apache ANT和Java运行时。
Note that these are not cordova specific requirements, but requirements for Android development with the SDK. 请注意,这些并非Cordova特定要求,而是使用SDK开发Android的要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.