Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having Android Problems with Sun javax jars

Tags:

android

I have been working on a Android Web Services program that uses a number of classes from Sun's javax libraries. The eclipse IDE is barking "Attempt to include a core class (java.* or javax.* ) in something other than a core library." My application is an Android application and I am not creating a core library. I am using several .jars; javax.xml.ws, javax.xml.bind, javax.xml.soap, javax.xml.rpc, and javax.jws. I believe I cannot use these java bytecode .jars directly. I will have to use the dx tool to convert them to delvik bytecode or .dex files. I have done some additional research and have found that use of any javax.* classes in an android application are forbidden. Can someone explain why? Are their practical programming work arounds?

Thanks, Steve

like image 394
Steve Mansfield Avatar asked Jun 28 '10 19:06

Steve Mansfield


2 Answers

That's because those jars use core core libraries. Android does not support the complete J2SE, but rather a subset of it: http://developer.android.com/reference/packages.html

Thus, you cannot use Java core libraries because they don't belong to the Android SDK.

like image 103
Cristian Avatar answered Oct 15 '22 22:10

Cristian


You need to use an alternate library to handle SOAP in Android - the Sun provided libraries do not work.

One popular alternative is KSOAP2.

like image 28
Yann Ramin Avatar answered Oct 15 '22 21:10

Yann Ramin