gpt4 book ai didi

java - 执行 phonegap 命令 cordova build 时出错

转载 作者:行者123 更新时间:2023-11-29 03:24:16 25 4
gpt4 key购买 nike

我正在执行命令“cordova build”(完成上述设置后,示例链接Phonegap The Command-Line Interface)。
但是 note.js 返回这个错误:

Generating config.xml from defaults for platform "android"
Preparing android project
Compiling app on platform "android" via command "cmd" /c
C:\Net\Phonegap\hello\platforms\android\cordova\build
Error: An error occurred while building the android project.Error executing "ant" debug -f "C:\Net\Phonegap\hello\platforms\android\build.xml"":
BUILD FAILED
C:\Net\templates\Phonegap\android-sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
C:\Net\templates\Phonegap\android-sdk\tools\ant\build.xml:720: The following error occurred while executing this line:
C:\Net\templates\Phonegap\android-sdk\tools\ant\build.xml:734: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre7"

Total time: 2 seconds

at ChildProcess. (C:\Users\myuserpc\AppData\Roaming\npm\node_modules\cordova\src\compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket. (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)

我的config.xml

<widget id="com.example.hello" version="0.0.1">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@callback.apache.org" href="http://phonegap.com">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="Fullscreen" value="true" />
<preference name="WebViewBounce" value="true" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>

还有我的 AndroidManifest.xml

<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.example.hello" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|locale" android:label="@string/app_name" android:name="HelloWorld" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />

最佳答案

看起来您目前已经安装了 Java 运行时环境 (JRE)。您需要 Java 开发工具包 (JDK)。你可以在 Oracle 得到它.您的路径似乎使用 %JAVA_HOME%\bin 正确设置。我相信一旦安装了 JDK,您的 %JAVA_HOME% 环境变量将更改为类似于:C:\Program Files\Java\jdk1.7.0_52。当然,版本号可能略有不同。

关于java - 执行 phonegap 命令 cordova build 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21883146/

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