How do I build code using the Apache Harmony libraries?

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

How do I build code using the Apache Harmony libraries?

Postby nmbooker » Mon Oct 25, 2010 11:45 pm

Hi
I'm using Eclipse and the Google Android SDK plugin, trying to add SSL support to a Usenet reader. I'm using some of the code from the Android email app, which in turn uses the Apache Harmony libraries.

My target API level is 7.

However, Eclipse can't find the org.apache.harmony.xnet.provider.jsse.* (or any other harmony classes for that matter) and hence refuses to build and run the software.

How to I build my code against the Harmony libraries?

Nick
nmbooker
Freshman
Freshman
 
Posts: 4
Joined: Mon Oct 25, 2010 11:32 pm

Top

Re: How do I build code using the Apache Harmony libraries?

Postby nmbooker » Tue Oct 26, 2010 6:34 pm

I've just had another go on my own, and by downloading the HDK from the Apache Harmony download site and adding the "x-net.jar" from that to the build path it appeared to pick it up.

However, it's now complaining that "The method getDefaultTrustManager() is undefined for the type SSLParameters".

The method definitely exists (at least in the Android platform) because the Email app calls it, but it Eclipse doesn't seem to want to see it.

I have the HDK for JVM 6.0.

What am I doing wrong?

Thanks,

Nick
Edit: Added the jar name
nmbooker
Freshman
Freshman
 
Posts: 4
Joined: Mon Oct 25, 2010 11:32 pm

Re: How do I build code using the Apache Harmony libraries?

Postby nmbooker » Tue Oct 26, 2010 6:50 pm

So I changed to the HDK for JVM 5.0 and that error went away, but it seems that x-net.jar contains / re-implements part of the standard library (javax.net.DefaultServerSocketFactory) so I get the error "Conversion to Dalvik format failed with error 1".

This is produced in the console:
trouble processing "javax/net/DefaultServerSocketFactory.class":
Attempt to include a core class (java.* or javax.*) in something other
than a core library. It is likely that you have attempted to include
in an application the core library (or a part thereof) from a desktop
virtual machine. This will most assuredly not work. At a minimum, it
jeopardizes the compatibility of your app with future versions of the
platform. It is also often of questionable legality.
[snip]

It continues for 3 more paragraphs about why I shouldn't try to build parts of the standard library.

Which returns me to the original question -- what's the proper way to build my Android software against the Apache Harmony libraries?

Nick
nmbooker
Freshman
Freshman
 
Posts: 4
Joined: Mon Oct 25, 2010 11:32 pm

Re: How do I build code using the Apache Harmony libraries?

Postby nmbooker » Tue Oct 26, 2010 9:02 pm

Solved!

The solution was to remove the Apache Harmony reference and add as a user library the JAR file SDKPATH/platforms/android-7/data/layoutlib.jar

This provided everything I needed to build against the harmony libraries.

Sorry if I've wasted anybody's time.

Nick
nmbooker
Freshman
Freshman
 
Posts: 4
Joined: Mon Oct 25, 2010 11:32 pm

Re: How do I build code using the Apache Harmony libraries?

Postby pimmling » Fri Feb 25, 2011 5:39 pm

Hello,

Could you please tell where was the reference list to the Apache AHrmony that you removed??

Thanks
pimmling
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Feb 25, 2011 5:10 pm

Re: How do I build code using the Apache Harmony libraries?

Postby geetanjalikatare » Sun Dec 18, 2011 8:27 am

will please post how to include jar files form apache harmony HDK??i have downloaded the HDK but unable to find required jar files.i.e. awt.jar and beans.jar
geetanjalikatare
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Dec 18, 2011 8:20 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests