Luanna Iozzi
Luanna Iozzi

Reputation: 146

Error executing phonegap command cordova build

I'm executing the command "cordova build" (After finishing the above settings, exemplified this link Phonegap The Command-Line Interface).
But the note.js returns this error:

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)

My 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="[email protected]" 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>

And my 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" />

Upvotes: 1

Views: 4044

Answers (1)

Drew B.
Drew B.

Reputation: 1145

It looks like you currently have the Java Runtime Environment (JRE) installed. You need the Java Development Kit (JDK). You can get that over at Oracle. Your path does appear to be set up correctly with %JAVA_HOME%\bin. I believe once you install the JDK, your %JAVA_HOME% environment variable will be changed to something similar to: C:\Program Files\Java\jdk1.7.0_52. The version number might be slightly different of course.

Upvotes: 4

Related Questions