简体   繁体   English

无法在cordova 3.3中添加android平台

[英]Can't add android platform in cordova 3.3

I tried to add the android platform by: 我尝试通过以下方式添加android平台:

$ cordova platform add android

I get that out: 我明白了:

    Creating android project...

/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error: An error occured during creation of android sub-project. 

/Users/jannisportmann/.cordova/lib/android/cordova/3.3.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.
    at /Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
    at _rejected (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
    at /Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
    at Promise.when (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
    at /Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
    at flush (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

    at /usr/local/lib/node_modules/cordova/src/platform.js:244:30
    at ChildProcess.exithandler (child_process.js:641:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

I specified the SDK's path in the .bash_profile, is there something more I need to do? 我在.bash_profile中指定了SDK的路径,还有什么我需要做的吗?

Thanks for answers! 谢谢你的回答!

I fixed it!! 我修好了它!! First you have to add android tools and platform tools to your PATH... 首先,你必须添加Android工具和平台工具到你的PATH ...

So open your user profile ( in terminal type:) 所以打开你的用户档案(在终端类型:)

nano ~/.profile
PATH=$PATH:/YOUR_ADT_FOLDER/sdk/platform-tools:/YOUR_ADT_FOLDER/sdk/tools
export PATH

Save it and type on terminal: 保存并在终端上输入:

. ~/.profile

Now try to add your cordova platform, if it not works try to install apache ant. 现在尝试添加您的cordova平台,如果不起作用,请尝试安装apache ant。 I'm using elementary os, so I opened the software center, searched for ant e install it. 我正在使用初级操作系统,所以我打开了软件中心,搜索了安装它。 After it see if 'ant' is on your terminal and then add your platform. 看看你的终端上是否有'ant',然后添加你的平台。

For OSX your path needs to include /Users/yourusername 对于OSX,您的路径需要包含/ Users / yourusername

their example: /Development/adt-bundle/sdk/platform-tools 他们的例子:/ Development / adt-bundle / sdk / platform-tools
needs to be: /Users/yourusername/Development/adt-bundle/sdk/platform-tools 需要是:/ Users / yourusername / Development / adt-bundle / sdk / platform-tools

check your path with echo $PATH (use caps, it's case sensitive!) 使用echo $ PATH检查你的路径(使用大写,区分大小写!)

this is documentation Phonegab docs for setup .bash_profile(mac),bashrc(linux), or windows 这是用于安装.bash_profile(mac),bashrc(linux)或windows的文档Phonegab文档

and my .bash_profile: 和我的.bash_profile:

export PATH=${PATH}:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/platform-tools:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/tools

visit the solution here 这里访问解决方案

I hope this helps you 我希望这可以帮助你

尝试,

cordova platform add android

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

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