Phonegap我无法将android平台添加到我的项目中

时间:2014-03-22 14:10:42

标签: android cordova phonegap-build

我已经安装了Android SDK和$ PATH。但它无法将android平台添加到我的项目中。 请帮帮我。

这是我的$ PATH

/Users/xxx/Applications/eclipse/sdk/platform-tools:/Users/xxx/Applications/eclipse/sdk/tools:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

当我将android平台添加到我的项目时,这是错误的

    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/xxx/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:85:29
    at _rejected (/Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
    at /Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
    at Promise.when (/Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
    at /Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
    at flush (/Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)
Error: /Users/xxx/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:112:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)

2 个答案:

答案 0 :(得分:1)

创建文件.bash_profile并保存在您的主目录中。

enter image description here

然后将此脚本复制到此文件中。

export PATH="/Applications/android-sdk/tools:/Applications/android-sdk/platform-tools:$PATH"

答案 1 :(得分:0)

看起来你错过了什么,

要检查SDK,只需打开命令提示符并输入“android”,并确保它打开SDK管理器并检查您是否安装了Android最新版本。

这是我的路径,完美配置了phonegap并与eclipse集成,

C:\Program Files (x86)\nodejs\;
%ANDROID_HOME%\tools;
%ANDROID_HOME%\platform-tools;
C:\Program Files (x86)\Java\jdk1.7.0_03;
C:\Program Files (x86)\Java\jdk1.7.0_03\bin;
%ANT_HOME%\bin;
%ANT_HOME%\lib;
F:\Phonegap\windows_adt\sdk\platform-tools;F:\Phonegap\windows_adt\sdk\tools;
%JAVA_HOME%\bin;
%ANT_HOME%\bin;
C:\Program Files (x86)\Git\bin

以下是子链接

ANDROID_HOME: F:\Phonegap\windows_adt\sdk
ANT_HOME: C:\Program Files (x86)\ANT\apache-ant-1.9.2
JAVA_HOME: C:\Program Files (x86)\Java\jdk1.7.0_03