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

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

问题描述

我正在尝试将我现有的项目从 cordova 2.1 迁移到最新的 3.1,可以通过命令行进行 installev,

I am trying to migrate my existing project from cordova 2.1 to the latest, 3.1 which 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

哪些日志:

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?

推荐答案

适用于 MAC 1000000000% 的 Cordova Android.我争取解决方案,现在我正在尝试这个 @Toni Michel Caube.我很乐意分享我的答案.

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. 触摸 ~/.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

如果你想查看你的环境路径:

if you want to see your environment path:

7.在你的终端输入:set

你可以看到后喜欢

8. 只要你做得非常正确.在您输入命令后,如 cordova 平台添加 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

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天全站免登陆