tags:

views:

2053

answers:

4

hi, When i am including the jaxp jar file i am getting the error as follows

trouble processing "javax/xml/XMLConstants.class":
[2009-05-08 16:53:18 - TestProject] 
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2009-05-08 16:53:18 - TestProject] 1 error; aborting
[2009-05-08 16:53:18 - TestProject] Conversion to Dalvik format failed with error 1

is anybody has faced this problem any help will be really appreciated i have goend some solution but they are not specific

A: 

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.

If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message.

If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem.

If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation.

Guido
Aye, I saw this in the Eclipse console, but it's helplessly pedantic ("Prolix! Prolix!"). All I want to do is try this simple tutorial under the Android 2.0 SDK:http://developer.android.com/guide/tutorials/views/hello-webview.htmlI'm not including a core class or building a core library or any of that. I'm just tire-kicking and making a really simple app. There has to be a simpler, more easily understood explanation _and_ resolution to this.
Joe D'Andrea
+1  A: 

I see two possibilities:

In your project's folder, the file .classpath could be wrong. Try to replace it with:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>

If it does not work, it means the library you are trying to include is not compatible with Android.

Nicolas Raoul
+1  A: 

I'm not including a core class or building a core library or any of that.

yes, you are:

trouble processing "javax/xml/XMLConstants.class"

java.* and javax.* both count. you can use the --core-library switch if you just want to ignore this in a test app, but heed the warning: "your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem."

the right fix, as it says, for a shipping app, is to repackage those classes (i.e. move them to a new directory, edit their "package" lines correspondingly, and update the "import" lines in their callers).

Elliott Hughes
A: 

If you are including a core class then this error is self explanatory. If you aren't (search your code, just to make sure) then I have seen this error from time to time only when using Eclipse when the Android "library" gets added to the Eclipse build path multiple times on accident.

I don't know how it gets in that state, but it has happened to me twice now. To resolve it, you need to fix the .classpath file as Nicolas noted. Another way to do that is to edit the "Java Build Path" (right click on the project and select properties) and remove your Android* libraries (if there are more than one remove them all).

This will cause the project to fail to compile and have many errors, but, once you are sure you have gotten rid of all the libraries you can then right click the project again and select "Android Tools"->"Fix Project Properties" and the correct (single copy) of Android.jar will be added back and things should work fine again from there.

Charlie Collins