Cordova and setting Android using command line(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.
步骤:
打开你的终端,然后,
触摸 ~/.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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Cordova 和使用命令行设置 Android
基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
