简体   繁体   English

无法在Mac的Cordova中添加android平台

[英]Can't add android platform in cordova on Mac

I'm not sure what step I've missed, but I cannot get Cordova to add the android platform to my sample project. 我不确定我错过了哪一步,但是我无法让Cordova将android平台添加到我的示例项目中。

This what I am getting from Terminal: 这是我从Terminal得到的:

:hello2 my-username$ cordova platform add android
Creating android project...

/Users/my-username/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
                    throw e;
                      ^
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.

And this is what I have in my .bash_profile: 这就是我的.bash_profile中的内容:

export PATH=${PATH}:/Users/my-username/Documents/Development/sdk/platform-tools:/Users/my-username/Documents/Development/sdk/tools

My /Development directory is set up like this: 我的/ Development目录设置如下:

/eclipse /日食

/hello2 / hello2

/sdk / sdk

Any help would be much appreciated. 任何帮助将非常感激。

A few ideas: 一些想法:

Check your ant installation is working ok with "ant -version". 使用“ ant -version”检查您的ant安装是否正常。

Add the following to your bash profile (you may have ant installed somewhere else, so check/find your path in Finder first): 将以下内容添加到您的bash配置文件中(您可能已在其他位置安装了ant,因此请首先在Finder中检查/查找路径):

export PATH="${PATH}:/usr/share/ant/bin" 导出PATH =“ $ {PATH}:/ usr / share / ant / bin”

Reboot to apply the new shell paths. 重新启动以应用新的外壳程序路径。

Check your path output in your shell with: "echo $PATH" to ensure it is what you think it is. 使用以下命令在shell中检查路径输出:“ echo $ PATH”以确保它是您想要的。

I think you haven't define the path for android-sdk. 我认为您尚未定义android-sdk的路径。 Make sure you have installed latest updated version of android-sdk. 确保您已安装android-sdk的最新更新版本。

Path for android-sdk: -ANDROID_HOME (C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools) android-sdk的路径:-ANDROID_HOME(C:\\ Program Files(x86)\\ Android \\ android-sdk \\ platform-tools)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM