Allan
Allan

Reputation: 1053

My Android app is getting the "Trouble Processing" error

My android app was running ok under Eclipse, then I tried to add some GridView sample code from some online examples and now it will not build/run anymore. I keep getting the major error:

trouble processing "javax/net/SocketFactory.class": [2010-08-10 17:35:12 - CLife] Attempt to include a core VM class in something other than a core library.

I have never put anything to do with 'SocketFactory' in any of my code. I searched all of my code and can't find any code that I did that contains the SocketFactory.class.

I deleted my xml's and classes that I was working on that had to do with the GridView and reverted back to the code I had before, when it was running - but now I continue to get the above error. I even try to use 'Clean' but the error continues.

Does anyone know what I should do about this error?

Upvotes: 1

Views: 2126

Answers (2)

Christi
Christi

Reputation: 21

If you are working on a larger project with other third party libraries, I found it much better to use the android.jar from a maven repository...

The reason is that the android.jar ships with a bunch of other libraries, for example junit 3. So if you want to use junit 4 tests, you have to worry about where the two .jars are on the classpath so the junit 3 doesn't shadow your junit 4 jar.

Also note that some third party libraries use a package structure that Android doesn't like. For example stax-api-1.0.1.jar. It has a package structure like:

javax.xml.stream.events.StartElement.class

So when you try to create the apk file it will tell you something like:

[apply] trouble processing "javax/xml/stream/events/StartElement.class":
[apply] 
[apply] Ill-advised or mistaken usage of a core class (java.* or javax.*)
[apply] when not building a core library.
[apply] 
[apply] This is often due to inadvertently including a core library file
[apply] in your application's project, when using an IDE (such as
[apply] Eclipse). If you are sure you're not intentionally defining a
[apply] core class, then this is the most likely explanation of what's
[apply] going on.
[apply] 
[apply] However, you might actually be trying to define a class in a core
[apply] namespace, the source of which you may have taken, for example,
[apply] from a non-Android virtual machine project. This will most
[apply] assuredly not work. At a minimum, it jeopardizes the
[apply] compatibility of your app with future versions of the platform.
[apply] It is also often of questionable legality.
[apply] 
[apply] If you really intend to build a core library -- which is only
[apply] appropriate as part of creating a full virtual machine
[apply] distribution, as opposed to compiling an application -- then use
[apply] the "--core-library" option to suppress this error message.
[apply] 
[apply] If you go ahead and use "--core-library" but are in fact
[apply] building an application, then be forewarned that your application
[apply] will still fail to build or run, at some point. Please be
[apply] prepared for angry customers who find, for example, that your
[apply] application ceases to function once they upgrade their operating
[apply] system. You will be to blame for this problem.
[apply] 
[apply] If you are legitimately using some code that happens to be in a
[apply] core package, then the easiest safe alternative you have is to
[apply] repackage that code. That is, move the classes in question into
[apply] your own package namespace. This means that they will never be in
[apply] conflict with core system classes. JarJar is a tool that may help
[apply] you in this endeavor. If you find that you cannot do this, then
[apply] that is an indication that the path you are on will ultimately
[apply] lead to pain, suffering, grief, and lamentation.

Upvotes: 2

MalcomTucker
MalcomTucker

Reputation: 7477

Try rightclicking on your project, Android Tools -> Fix Project Properties

Upvotes: 2

Related Questions