gpt4 book ai didi

android - Phonegap 错误 : ANDROID_HOME is not set

转载 作者:行者123 更新时间:2023-12-04 18:52:17 25 4
gpt4 key购买 nike

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

我正在使用 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

但是当我运行 sudo phonegap run android在我的 testapp 上它返回此错误
$ 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)

最佳答案

试试这个

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

关于android - Phonegap 错误 : ANDROID_HOME is not set,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27509878/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com