Unable to execute dex: Multiple dex files define L

2019-06-01 17:21发布

问题:

I am developing a android application which generates a PDF using droidtext and sends it as attachment with the email without invoking the email client.

I am using droidtext and java mail api to achieve this.And my lib directory is as follows. Minimum SDK version of 8 !!

activation.jar, additionnal.jar and mail.jar are required for email and droidtext.jar is required for generating pdf. when I run the application I get error as

[2013-08-11 21:09:04 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/harmony/awt/internal/nls/Messages;
[2013-08-11 21:09:04 - SuperResume] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/harmony/awt/internal/nls/Messages;

Any suggestion for its resolution ??

回答1:

This happens because some of the awt dependency classes are defined in additionnal.jar and droidText.0.5.jar. The easiest way to fix this is to rename the offending package in one of the two libraries.

E.g. check out droidtext as Android library project as described here: https://code.google.com/p/droidtext/wiki/GettingStarted and then refactor/rename the org.apache.harmony package to some different name