Phonegap错误:未设置ANDROID_HOME

时间:2014-12-16 16:57:21

标签: android cordova ubuntu

似乎我说错了,或者我做错了

我正在使用ubuntu /基本操作系统

我添加了

的路径

tail ~/.bashrc

给我这个

export HOME="/home/jsantana"
export ANDROID_HOME="$HOME/Downloads/android-studio/sdk"
export PATH="$PATH:/$ANDROID_HOME/tools:/$ANDROID_HOME/platform-tools"

echo $PATH

返回此

//home/jsantana/Downloads/android-studio/sdk/tools://home/jsantana/Downloads/android-studio/sdk/platform-tools

但是当我在我的testapp上运行sudo phonegap run android时,它会返回此错误

$ sudo phonegap run android
[phonegap] executing 'cordova run android'...
cp: no such file or directory: /home/jsantana/phonegap/testapp/icon.png


Running command: /home/jsantana/phonegap/testapp/platforms/android/cordova/run 

ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

Error: /home/jsantana/phonegap/testapp/platforms/android/cordova/run: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

真的不确定我在这里做错了什么。

路径正确但仍然说它们不正确

编辑:

所以我改了一下但仍然得到了同样的错误:

export HOME="/home/jsantana"
export ANDROID_HOME="$HOME/Downloads/android-studio/sdk"
export PATH="${PATH}:/home/jsantana/Downloads/android-studio/sdk/platform-tools"
export PATH="${PATH}:/home/jsantana/Downloads/android-studio/sdk/tools"

当我$ echo $PATH

/home/jsantana/Downloads/android-studio/sdk/tools:/home/jsantana/Downloads/android-studio/sdk/platform-tools

得到同样的错误

[phonegap] executing 'cordova run android'...
cp: no such file or directory: /home/jsantana/phonegap/testapp/icon.png


Running command: /home/jsantana/phonegap/testapp/platforms/android/cordova/run 

ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

Error: /home/jsantana/phonegap/testapp/platforms/android/cordova/run: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

1 个答案:

答案 0 :(得分:0)

试试这个

export PATH=${PATH}:/home/jsantana/Downloads/android-studio/sdk/platform-tools
export PATH=${PATH}:/home/jsantana/Downloads/android-studio/sdk/tools