gpt4 book ai didi

android - 出现错误,同时为 phonegap 添加 android 平台

转载 作者:太空宇宙 更新时间:2023-11-03 10:19:40 25 4
gpt4 key购买 nike

今天我启动了 phonegap,根据文档,我正在尝试将我的环境设置到我的本地机器中。

在这个过程中,我安装了android SDK,并在bashrc文件中设置了环境变量。

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JAVA_HOME
PATH=$PATH:$JAVA_HOME

ANDROID_HOME=$HOME/Git/adt-bundle-linux/sdk
export ANDROID_HOME
PATH=$PATH:$ANDROID_HOME

ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
export ANDROID_PLATFORM_TOOLS
PATH=$PATH:$ANDROID_PLATFORM_TOOLS

ANDROID_TOOLS=$ANDROID_HOME/tools
export ANDROID_TOOLS
PATH=$PATH:$ANDROID_TOOLS
export PATH

ANT_HOME=/usr/share/ant
export ANT_HOME
PATH=$PATH:$ANT_HOME/bin

我切换到我的工作主管并在运行 cordova platform add android 后收到以下错误

Creating android project...

/home/.cordova/lib/npm_cache/cordova-
android/3.6.3/package/bin/node_modules/q/q.js:126
throw e;
^
Error: Failed to run "javac -version", make sure you have a Java JDK (not just a JRE) installed.
at /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:43:27
at ChildProcess.exithandler (child_process.js:651:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Error: /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
@barrett:~/Git/phonegap/hellowPhonegap$

使用“sudo”运行相同的命令,如 sudo cordova platform add android,抛出以下错误。

 /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
at /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:158:19
at _fulfilled (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:760:13)
at /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:821:14
at flush (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
Error: /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

我稍后使用哪个命令。如果其中之一,问题是什么。

谁能帮帮我。

最佳答案

我遇到了同样的问题让我们这样做 javac -version 然后它会显示可用的版本,例如

The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.8-jdk
* openjdk-7-jdk
* gcj-4.6-jdk
* openjdk-6-jdk
Try: sudo apt-get install <selected package>

休耕。我希望这对你有帮助。

关于android - 出现错误,同时为 phonegap 添加 android 平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26161554/

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