rgladwell/m2e-android — Issue #46: Dex failures with ADT r13
Author: joakime
Created: 2011-10-23 01:33:25+00:00
State: open

Getting a bunch of dex failures when running with Eclipse Indigo SR1 64bit + Linux 64bit + Oracle JDK 1.6.0_27 (64bit) when using ...

com.jayway.maven.plugins.android.generation2
android-maven-plugin
3.0.0-alpha-13

Example of the Dex errors (as seen in the Eclipse Android Console)

[2011-10-22 18:25:18 - install-history] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$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.
[2011-10-22 18:25:18 - install-history] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$2) 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.
...(snip)...
[2011-10-22 18:25:20 - install-history] Dx
trouble processing "javax/xml/parsers/DocumentBuilder.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. 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. JarJar is a tool that may help
you in this endeavor. 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.

[2011-10-22 18:25:20 - install-history] Dx 1 error; aborting
[2011-10-22 18:25:20 - install-history] Conversion to Dalvik format failed with error 1

__When running the latest master of the m2e-android codebase, another dex error appears.__

18:31:34.408 [Worker-6] DEBUG o.e.m.c.i.builder.MavenBuilder - Executing build participant me.gladwell.eclipse.m2e.android.AndroidMavenBuildParticipant for plugin execution com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.0.0-alpha-13:generate-sources (execution: default-generate-sources, phase: generate-sources)
ANDROID-040-003: Error Log not set: Will not output error logs
ANDROID-040-000: Executed command: Commandline = /bin/sh -c /home/joakim/java/android/android-sdk-linux/platform-tools/dx --dex --output=/home/joakim/code/erdfelt/android-install-history/solshen-install-history/bin/classes/install-history.apk /home/joakim/code/erdfelt/android-install-history/solshen-install-history/target/android-classes /home/joakim/code/erdfelt/android-install-history/solshen-install-history/bin/classes/install-history.apk, Result = 1
me.gladwell.android.tools.AndroidToolsException: error executing dx command=[me.gladwell.android.tools.drivers.DexCommand@13437ab2]
at me.gladwell.android.tools.CommandLineAndroidTools.convertClassFiles(CommandLineAndroidTools.java:45)
at me.gladwell.eclipse.m2e.android.AndroidMavenBuildParticipant.build(AndroidMavenBuildParticipant.java:81)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:180)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: me.gladwell.android.tools.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c /home/joakim/java/android/android-sdk-linux/platform-tools/dx --dex --output=/home/joakim/code/erdfelt/android-install-history/solshen-install-history/bin/classes/install-history.apk /home/joakim/code/erdfelt/android-install-history/solshen-install-history/target/android-classes /home/joakim/code/erdfelt/android-install-history/solshen-install-history/bin/classes/install-history.apk, Result = 1, Error = UNEXPECTED TOP-LEVEL EXCEPTION:java.util.zip.ZipException: error in opening zip file	at java.util.zip.ZipFile.open(Native Method)	at java.util.zip.ZipFile.(ZipFile.java:127)	at java.util.zip.ZipFile.(ZipFile.java:143)	at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:206)	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)	at com.android.dx.command.dexer.Main.processOne(Main.java:418)	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)	at com.android.dx.command.dexer.Main.run(Main.java:206)	at com.android.dx.command.dexer.Main.main(Main.java:174)	at com.android.dx.command.Main.main(Main.java:95)1 error; aborting
at me.gladwell.android.tools.drivers.MavenCommandExecutor.executeCommand(MavenCommandExecutor.java:97)
at me.gladwell.android.tools.drivers.MavenCommandExecutor.executeCommand(MavenCommandExecutor.java:69)
at me.gladwell.android.tools.drivers.DexCommand.execute(DexCommand.java:41)
at me.gladwell.android.tools.CommandLineAndroidTools.convertClassFiles(CommandLineAndroidTools.java:43)
... 14 more
18:31:34.892 [Worker-6] DEBUG o.e.m.c.i.builder.MavenBuilder - Exception in build participant me.gladwell.eclipse.m2e.android.AndroidMavenBuildParticipant
org.eclipse.core.runtime.CoreException: error buildiing android project
at me.gladwell.eclipse.m2e.android.AndroidMavenBuildParticipant.build(AndroidMavenBuildParticipant.java:91) ~[na:na]
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:180) ~[na:na]
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) [org.eclipse.equinox.common_3.6.0.v20110523.jar:na]
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) [org.eclipse.equinox.common_3.6.0.v20110523.jar:na]
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241) [org.eclipse.core.resources_3.7.100.v20110510-0712.jar:na]
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) [org.eclipse.core.jobs_3.5.100.v20110404.jar:na]
Caused by: me.gladwell.android.tools.AndroidToolsException: error executing dx command=[me.gladwell.android.tools.drivers.DexCommand@13437ab2]
at me.gladwell.android.tools.CommandLineAndroidTools.convertClassFiles(CommandLineAndroidTools.java:45) ~[na:na]
at me.gladwell.eclipse.m2e.android.AndroidMavenBuildParticipant.build(AndroidMavenBuildParticipant.java:81) ~[na:na]
... 13 common frames omitted
Caused by: me.gladwell.android.tools.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c /home/joakim/java/android/android-sdk-linux/platform-tools/dx --dex --output=/home/joakim/code/erdfelt/android-install-history/solshen-install-history/bin/classes/install-history.apk /home/joakim/code/erdfelt/android-install-history/solshen-install-history/target/android-classes /home/joakim/code/erdfelt/android-install-history/solshen-install-history/bin/classes/install-history.apk, Result = 1, Error = UNEXPECTED TOP-LEVEL EXCEPTION:java.util.zip.ZipException: error in opening zip file	at java.util.zip.ZipFile.open(Native Method)	at java.util.zip.ZipFile.(ZipFile.java:127)	at java.util.zip.ZipFile.(ZipFile.java:143)	at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:206)	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)	at com.android.dx.command.dexer.Main.processOne(Main.java:418)	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)	at com.android.dx.command.dexer.Main.run(Main.java:206)	at com.android.dx.command.dexer.Main.main(Main.java:174)	at com.android.dx.command.Main.main(Main.java:95)1 error; aborting
at me.gladwell.android.tools.drivers.MavenCommandExecutor.executeCommand(MavenCommandExecutor.java:97) ~[na:na]
at me.gladwell.android.tools.drivers.MavenCommandExecutor.executeCommand(MavenCommandExecutor.java:69) ~[na:na]
at me.gladwell.android.tools.drivers.DexCommand.execute(DexCommand.java:41) ~[na:na]
at me.gladwell.android.tools.CommandLineAndroidTools.convertClassFiles(CommandLineAndroidTools.java:43) ~[na:na]
... 14 common frames omitted

_The command line behavior seems to have changed with r14_

(the behavior that m2e-android expects)
dx --dex --output=bin/classes/install-history.apk target/android-classes bin/android-install-history.apk

UNEXPECTED TOP-LEVEL EXCEPTION:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:131)
at java.util.zip.ZipFile.(ZipFile.java:148)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:206)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:95)
1 error; aborting