Phonegap.jar build failed, ant build failed.

743 views
Skip to first unread message

Kudy

unread,
Oct 6, 2010, 11:41:39 PM10/6/10
to phonegap
I have been trying to get phonegap working for a few weeks now, on
Ubuntu. I've finally gotten all of the issues with environment
variables and ruby ironed out, but I've run into a problem I haven't
seen mentioned elsewhere, and I am not familiar enough with this stuff
to recognize what might be the root of the problem.

If I run the "new" command ("$ ruby bin/droidgap create test_app"), I
get this error message:

/home/kevin/phonegap-android/lib/create.rb:32:in `guess_paths': No
index.html found! (RuntimeError)
from /home/kevin/phonegap-android/lib/create.rb:7:in `initialize'
from bin/droidgap:24:in `new'
from bin/droidgap:24:in `<main>'

If I run the "classic" command ("$ ruby bin/droidgap classic "/home/
kevin/android-sdk-linux_86" test_app com.upc.test_app "example/" "/
home/kevin/phonegap-android/test_app") I get this error message:

BUILD FAILED
java.lang.NoClassDefFoundError: gnu/classpath/Configuration
at com.sun.tools.javac.Main.<clinit>(Main.java:66)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
.... [lots more lines with "at blah blah blah"]

Basically, I think it's failing when building the phonegap.jar file.
If I try and run "$ ant jar" in the framework directory, I get the
same failure message.

My best guess is that this has something to do with Java not working.
I've recently installed the Java JDK 1.6.0.20 from Sun, and it seemed
to fix a few errors I had the last time I worked on this. Any help or
leads someone would provide for what I am dealing with here would be
great- hopefully this is my last hurdle before I get to actually start
using droidgap.

Simon MacDonald

unread,
Oct 7, 2010, 1:31:02 PM10/7/10
to phonegap
You will have to use the JDK from Sun.  The Android SDK is dependent on classes only found in the Sun JDK.  

Simon Mac Donald
http://hi.im/simonmacdonald


--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com

Dave Johnson

unread,
Oct 7, 2010, 2:55:06 PM10/7/10
to Kudy, phonegap
There needs to be an index.html file in the folder you specify in
droidgap create. I think you can try the example folder in the
phonegap-android folder like "ruby bin/droidgap create example"

In general if you add the bin folder of phonegap-android to your path,
you should be able to run

"droidgap gen test_app" from wherever you want to create the test_app
folder. Then from in the test_app folder you can run "droidgap create"
and it will create a sibling folder called test_app_android.

Kudy

unread,
Oct 11, 2010, 11:33:39 PM10/11/10
to phonegap
Thanks for the reply Simon - I believe that I am using the JDK from
Sun, as I stated in my post, I recently installed Java JDK 1.6.0.20
from Sun, is this not the correct install to make my JAVA_HOME
envirnment variable?

Thanks!

On Oct 7, 11:31 am, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> You will have to use the JDK from Sun.  The Android SDK is dependent on
> classes only found in the Sun JDK.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
> > phonegap+u...@googlegroups.com<phonegap%2Bunsu...@googlegroups.com>

Kudy

unread,
Oct 11, 2010, 11:39:18 PM10/11/10
to phonegap
Dave, thank you very much! Your tips here have helped. I am now
seeing a different error message:

"BUILD FAILED
/home/kevin/phonegap-android/framework/build.xml:49: taskdef class
com.android.ant.SetupTask cannot be found"

and then it complains that phonegap.jar is missing - I believe this
might be related to the java issue I mentioned in my first post,
something is wrong with my java install that makes it not compile
phonegap.jar?

Thanks!


On Oct 7, 12:55 pm, Dave Johnson <d...@nitobi.com> wrote:
> There needs to be an index.html file in the folder you specify in
> droidgap create. I think you can try the example folder in the
> phonegap-android folder like "ruby bin/droidgap create example"
>
> In general if you add the bin folder of phonegap-android to your path,
> you should be able to run
>
> "droidgap gen test_app" from wherever you want to create the test_app
> folder. Then from in the test_app folder you can run "droidgap create"
> and it will create a sibling folder called test_app_android.
>

Dave Johnson

unread,
Oct 12, 2010, 1:31:32 PM10/12/10
to Kudy, phonegap
If an android ant task cannot be found then I think that ANDROID_HOME
env variable must not be correct...

Kudy

unread,
Oct 13, 2010, 7:45:06 PM10/13/10
to phonegap
I think I've had a problem with ANDROID_HOME - I've set it in /etc/
environment and in ~/.bashrc but still not had the command "android"
recognized - what can I do to ensure that it is working, and what
might I be doing wrong in Ubuntu to set ANDROID_HOME?

I really appreciate all of the help.

On Oct 12, 11:31 am, Dave Johnson <d...@nitobi.com> wrote:
> If an android ant task cannot be found then I think that ANDROID_HOME
> env variable must not be correct...
>

Dave Johnson

unread,
Oct 14, 2010, 5:07:38 AM10/14/10
to Kudy, phonegap

The android-sdk/tools folder should also be in your path.

Golden

unread,
Oct 14, 2010, 1:01:54 PM10/14/10
to phonegap
I am getting a similar error

JAVA_HOME=c:\progra~1\java\jdk1.6.0_21;c:\progra~1\java
\jdk1.6.0_21\lib
ANT_HOME=c:\work\apache-ant-1.8.1-bin\apache-ant-1.8.1
ANDROID_HOME=C:\WORK\android-sdk-windows

The script is saying Unable toe find a javac compiler. However, if I
run javac at the command line, I can see a compiler.

The error message tells me that JAVA_HOME does not point to JDK.

Dave Johnson

unread,
Oct 14, 2010, 1:28:30 PM10/14/10
to Golden, phonegap
based on a few searches, tools.jar should be on the JAVA_HOME path for
things to work I think - wherever that may be :)

GoldenLion

unread,
Oct 16, 2010, 11:28:01 AM10/16/10
to phonegap
I also received this error.

I ran a batch file to look at the environment variables
echo %JAVA_HOME%
echo %ANT_HOME%
echo %ANDROID_HOME%

and the variable seem correct
also the javac is instantiating.

GoldenLion

unread,
Oct 16, 2010, 8:12:04 PM10/16/10
to phonegap
I read droidgap ruby script and followed it to the framework directory

It is suppose to run "ant jar" but it doesn't

When I run "ant jar" I get errors telling me
c:\work\android-sdk-windows\tools\ant\ant_rules_r3.xml failed
> > > using droidgap.- Hide quoted text -
>
> - Show quoted text -

Kudy

unread,
Oct 20, 2010, 8:42:19 PM10/20/10
to phonegap
I've verified that I have my path sorted out, and my variables
correct, and I am still getting an error, this time this:

"BUILD FAILED
java.lang.NoClassDefFoundError: gnu/classpath/Configuration"

followed by a series of java compile errors. I think I must be
missing something simple. Thanks again for all of the help so far!

On Oct 14, 3:07 am, Dave Johnson <d...@nitobi.com> wrote:
> The android-sdk/tools folder should also be in your path.
> >> >> > phonegap+u...@googlegroups.com<phonegap%2Bunsu...@googlegroups.com>
> >> >> > For more options, visit this group at
> >> >> >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> >> >> > For more info on PhoneGap or to download the code go
> towww.phonegap.com
>
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "phonegap" group.
> >> > To post to this group, send email to phon...@googlegroups.com
> >> > To unsubscribe from this group, send email to
> >> > phonegap+u...@googlegroups.com<phonegap%2Bunsu...@googlegroups.com>
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> >> > For more info on PhoneGap or to download the code go towww.phonegap.com
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "phonegap" group.
> > To post to this group, send email to phon...@googlegroups.com
> > To unsubscribe from this group, send email to
> > phonegap+u...@googlegroups.com<phonegap%2Bunsu...@googlegroups.com>

Simon MacDonald

unread,
Oct 20, 2010, 8:49:06 PM10/20/10
to phonegap
What Java compiler are you using? The reason I ask is that the
Android SDK will only work with one from Sun (Oracle).

GK

unread,
Oct 21, 2010, 12:44:33 PM10/21/10
to phonegap
Hi Simon,
All devices need different versions of java.....
What's your workaround for this?
GK


On Oct 20, 8:49 pm, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> What Java compiler are you using?  The reason I ask is that the
> Android SDK will only work with one from Sun (Oracle).
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
>
> On Wed, Oct 20, 2010 at 8:42 PM, Kudy <kevinm...@gmail.com> wrote:
> > I've verified that I have my path sorted out, and my variables
> > correct, and I am still getting an error, this time this:
>
> > "BUILD FAILED
> > java.lang.NoClassDefFoundError: gnu/classpath/Configuration"
>
> > followed by a series of java compile errors.  I think I must be
> > missing something simple.  Thanks again for all of the help so far!
>
> > On Oct 14, 3:07 am, Dave Johnson <d...@nitobi.com> wrote:
> >> The android-sdk/tools folder should also be in your path.
> >> On Oct 14, 2010 12:45 AM, "Kudy" <kevinm...@gmail.com> wrote:
>
> >> > I think I've had a problem with ANDROID_HOME - I've set it in /etc/
> >> > environment and in ~/.bashrc but stillnothad the command "android"
> >> > recognized - what can I do to ensure that it is working, and what
> >> > might I be doing wrong in Ubuntu to set ANDROID_HOME?
>
> >> > I really appreciate all of the help.
>
> >> > On Oct 12, 11:31 am, Dave Johnson <d...@nitobi.com> wrote:
> >> >> If an androidanttask cannot befoundthen I think that ANDROID_HOME
> >> >> env variable mustnotbe correct...
>
> >> >> On Tue, Oct 12, 2010 at 4:39 AM, Kudy <kevinm...@gmail.com> wrote:
> >> >> > Dave, thank you very much!  Your tips here have helped.  I am now
> >> >> > seeing a different error message:
>
> >> >> > "BUILD FAILED
> >> >> > /home/kevin/phonegap-android/framework/build.xml:49: taskdef class
> >> >> > com.android.ant.SetupTask cannot befound"
>
> >> >> > and then it complains that phonegap.jar is missing - I believe this
> >> >> > might be related to the java issue I mentioned in my first post,
> >> >> > something is wrong with my java install that makes itnotcompile
> >> >> > phonegap.jar?
>
> >> >> > Thanks!
>
> >> >> > On Oct 7, 12:55 pm, Dave Johnson <d...@nitobi.com> wrote:
> >> >> >> There needs to be an index.html file in the folder you specify in
> >> >> >> droidgap create. I think you can try the example folder in the
> >> >> >> phonegap-android folder like "ruby bin/droidgap create example"
>
> >> >> >> In general if you add the bin folder of phonegap-android to your path,
> >> >> >> you should be able to run
>
> >> >> >> "droidgap gen test_app" from wherever you want to create the test_app
> >> >> >> folder. Then from in the test_app folder you can run "droidgap create"
> >> >> >> and it will create a sibling folder called test_app_android.
>
> >> >> >> On Thu, Oct 7, 2010 at 4:41 AM,Kudy<kevinm...@gmail.com> wrote:
> >> >> >> > I have been trying to get phonegap working for a few weeks now, on
> >> >> >> > Ubuntu.  I've finally gotten all of the issues with environment
> >> >> >> > variables and ruby ironed out, but I've run into a problem I haven't
> >> >> >> > seen mentioned elsewhere, and I amnotfamiliar enough with this
> >> stuff
> >> >> >> > to recognize what might be the root of the problem.
>
> >> >> >> > If I run the "new" command ("$ ruby bin/droidgap create test_app"),
> >> I
> >> >> >> > get this error message:
>
> >> >> >> > /home/kevin/phonegap-android/lib/create.rb:32:in `guess_paths': No
> >> >> >> > index.htmlfound! (RuntimeError)
> >> >> >> >        from /home/kevin/phonegap-android/lib/create.rb:7:in
> >> `initialize'
> >> >> >> >        from bin/droidgap:24:in `new'
> >> >> >> >        from bin/droidgap:24:in `<main>'
>
> >> >> >> > If I run the "classic" command ("$ ruby bin/droidgap classic "/home/
> >> >> >> > kevin/android-sdk-linux_86" test_app com.upc.test_app "example/" "/
> >> >> >> > home/kevin/phonegap-android/test_app") I get this error message:
>
> >> >> >> > BUILD FAILED
> >> >> >> > java.lang.NoClassDefFoundError: gnu/classpath/Configuration
> >> >> >> >        at com.sun.tools.javac.Main.<clinit>(Main.java:66)
> >> >> >> >        at java.lang.Class.forName0(Native Method)
> >> >> >> >        at java.lang.Class.forName(Class.java:169)
> >> >> >> >        .... [lots more lines with "at blah blah blah"]
>
> >> >> >> > Basically, I think it's failing when building the phonegap.jar file.
> >> >> >> > If I try and run "$antjar" in the framework directory, I get the

Simon MacDonald

unread,
Oct 21, 2010, 1:07:07 PM10/21/10
to phonegap
There is no work around.  If you want to compile an Android application you will need to use an Oracle/Sun JDK.  The Android SDK makes references to private classes that are only included with Oracle/Sun JDK's.  This is not a limitation of PhoneGap, it is a limitation of the Android SDK.

I wasted a day trying to compile "Hello, Android" using my IBM JDK.  Please learn from my experience.

Kudy

unread,
Oct 25, 2010, 8:33:56 PM10/25/10
to phonegap
Simon, I am quite sure that I downloaded and installed the current
java version from Sun directly - there are a number of java versions
installed, but I am pointing the JAVA_HOME variable to the Sun version
- what should I check to be completely sure that I am referencing the
correct install?

Thanks,

-Kevin

On Oct 20, 6:49 pm, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> What Java compiler are you using?  The reason I ask is that the
> Android SDK will only work with one from Sun (Oracle).
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
>
> On Wed, Oct 20, 2010 at 8:42 PM,Kudy<kevinm...@gmail.com> wrote:
> > I've verified that I have my path sorted out, and my variables
> > correct, and I am still getting an error, this time this:
>
> > "BUILD FAILED
> > java.lang.NoClassDefFoundError: gnu/classpath/Configuration"
>
> > followed by a series of java compile errors.  I think I must be
> > missing something simple.  Thanks again for all of the help so far!
>
> > On Oct 14, 3:07 am, Dave Johnson <d...@nitobi.com> wrote:
> >> The android-sdk/tools folder should also be in your path.
> >> On Oct 14, 2010 12:45 AM, "Kudy" <kevinm...@gmail.com> wrote:
>
> >> > I think I've had a problem with ANDROID_HOME - I've set it in /etc/
> >> > environment and in ~/.bashrc but still not had the command "android"
> >> > recognized - what can I do to ensure that it is working, and what
> >> > might I be doing wrong in Ubuntu to set ANDROID_HOME?
>
> >> > I really appreciate all of the help.
>
> >> > On Oct 12, 11:31 am, Dave Johnson <d...@nitobi.com> wrote:
> >> >> If an android ant task cannot be found then I think that ANDROID_HOME
> >> >> env variable must not be correct...
>

Brian LeRoux

unread,
Oct 25, 2010, 9:19:19 PM10/25/10
to Kudy, phonegap
Unless you plan to hack on PhoneGap itself you could always use this
starter project:

http://github.com/brianleroux/phonegap-android-quickstart

It has a very recent version of phonegap.jar and phonegap.js ....good
enough to kick the tires. You'll have to generate a local.properties
for this to compile.

Simon MacDonald

unread,
Oct 26, 2010, 10:32:21 AM10/26/10
to phonegap
Hi Kevin,

I'm not sure of everything to check but based on the fact that the
error message refers to "gnu/classpath/Configuration" that tells me
you enviroment is not pointing to the Sun JDK. Here are a few things
I'd try to look at:

1) Do a "which javac" and see what javac is being refferenced.
2) Check your $PATH variable to make sure the the bin directory for
the Sun JDK is in there and comes before any other JDK bin dir.
3) Make sure your $JAVA_HOME points to the Sun JDK root directory not
the bin directory.

Kudy

unread,
Nov 17, 2010, 10:35:08 PM11/17/10
to phonegap
Thank you Brian, I was able to use your starter project successfully!

On Oct 26, 7:32 am, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> Hi Kevin,
>
> I'm not sure of everything to check but based on the fact that the
> error message refers to "gnu/classpath/Configuration" that tells me
> you enviroment is not pointing to the Sun JDK.  Here are a few things
> I'd try to look at:
>
> 1) Do a "which javac" and see what javac is being refferenced.
> 2) Check your $PATH variable to make sure the the bin directory for
> the Sun JDK is in there and comes before any other JDK bin dir.
> 3) Make sure your $JAVA_HOME points to the Sun JDK root directory not
> the bin directory.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
Reply all
Reply to author
Forward
0 new messages