Error executing Cordova build command

Asked

Viewed 772 times

6

I’m executing the command build cordova (after finishing the settings exemplified in this link: Phonegap The Command-Line Interface).

But the Node.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"":
FAILED BUILD
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 (Vents.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>
</widget>

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" />
</manifest>

My question is, what’s missing for that command cordova build work properly?

My Path is set right. I added the variable JAVA_HOME with the right path.

2 answers

2


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"

If I remember correctly, in fact there is no Java compiler in the JRE folder. I think your problem is this: or you assigned JAVA_HOME for the wrong folder or you don’t have a Java compiler installed in your environment (i.e. you need the Java SDK/JDK, not the JRE).

If you have a folder like "C:\Program Files\Java\jdk7" or something like that, that’s where your JAVA_HOME should point out.

  • True, I forgot to pay attention to it (To the main) I have only the JRE and assigns the JAVA_HOME for the way C:\Program Files\Java\jre7

1

To build on the android platform you need to install JDK, Apache Ant and Android SDK. You also need to configure the following environment variables in the OS: JAVA_HOME, ANDROID_HOME and ANT_HOME.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.