I have a couple of imported jars that have this error in Eclipse when the project builds:
[2011-04-08 16:31:48 - MokbeeAndroid] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(net.sf.antcontrib.logic.ForEach$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
Now, I didn't really care at first, because there were no errors. But I've now added Apache Sanselan, which has the same problem. Other Apache jars also do this, and not just once per jar, but once per class-that-has-an-inner-class, which makes every build pump out a monstrous console log. Worse, each warning seems to slow the Eclipse build process, and eventually Eclipse just crashes due to a memory overflow error. It's at the point where I can't build anything, even straight after my computer starts up.
The solution would seem to be to recompile the source (open-source and all), but none of it can be recompiled in anything but Maven, which, after doing so to no avail, I suspect is causing the problem in the first place.
I don't care about the results of the warning, just that Eclipse doesn't spend all it's memory on telling me about it. So, is there a way I can either remove the problem, or make Eclipse stop slowing down on it (skipping that check, maybe)?
This was causing me a lot of pain with the android-maven-plugin
and other libraries that included commons-logging
. It was blocking my build. What made it worse is that some libraries were included transitively, so simply using <exclude>
would not work. With a little hint from another post, I determined I could keep out the offending library altogether with something like this:
<!-- prevent commons-logging from being included by the Google HTTP client
dependencies -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
If you recompile the source of the libraries in Maven, you may need to update the Java version within the POMs to 1.6 (or whatever Java version you're using for your project). Just from looking at Sanselan, I note it specifically has 1.4 as the version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With