Cordova和使用命令行设置Android [英] Cordova and setting Android using command line

查看:191
本文介绍了Cordova和使用命令行设置Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我现有的项目从cordova 2.1迁移到最新的3.1,可以是installevvía命令行,

I am trying to migrate my existing project from cordova 2.1 to the latest, 3.1 wich can be installev vía command line,

我已经安装了Android SDK,

I already have the Android SDK installed,

因此:

sudo npm install -g cordova // All good
cordova create hello com.example.hello HelloWorld // All good
cordova platform add android // Then it fires:

Checking Android requirements...
[Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ]

所以我安装Macports并尝试:

So I installed Macports and tried:

sudo port install android

/ p>

Wich logs:

Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
--->  Cleaning android
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.

任何想法我在这里失踪了什么?

Any idea what am I missing here?

推荐答案

这是工作cordova Android为MAC 1000000000%。我战斗解决方案,现在我工作试试这个 @Toni Michel Caubet 。我很乐意分享我的答案。

It's work cordova Android for MAC 1000000000%. I fought solution and now i'm working try this @Toni Michel Caubet. I will happy to share my Answer.

步骤:

,然后是


  1. touch〜/ .bash_profile

打开〜/ .bash_profile

PATH =/ Users / System-Name / Documents / android-sdk-macosx / sdk / tools:/ Development / android-sdk-macosx / sdk / platform-tools:$ PATH这是存储在我的系统中的Android SDK位置

4.保存文件退出文本编辑器。

4.Save the file and quit the text editor.

5.执行 .bash_profile 更新您的PATH:

5.Execute your .bash_profile to update your PATH:

source〜/ .bash_profile

路径:

7.在您的终端类型中: set

7.In your terminal type: set

之后,您可以看到

8.就你所做的非常正确。在您输入 cordova platform add android 命令之后。您会得到以下错误。因为Java SDK不太设置环境PATH。

8.As far as your made it very correct. After your enter command like cordova platform add android. you get following error. because Java SDK doesn't too set environment PATH.

>

9。打开〜/ .bash_profile。添加JAVA_HOME值

9.open ~/.bash_profile. Add JAVA_HOME value

img src =https://i.stack.imgur.com/69POh.pngalt =enter image description here>

10.您可以看到环境,如STEP 7 set 。您应该可以看到:

10.You can see your environment like STEP 7 set. You should be able see:

11.成功创建环境现在可以使用Cordova或PhoneGap创建Android项目

11.Successfully created environment now you can create Android project with Cordova or PhoneGap

这篇关于Cordova和使用命令行设置Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆