[Android Notes] Unable to execute dex: Multiple dex files define solution, androiddex

Source: Internet
Author: User

[Android Notes] Unable to execute dex: Multiple dex files define solution, androiddex

Problem:Frequently needed in projectsAdd third-party jar packages. An error may be reported during compilation after a new jar package is added.Unable to execute dex: Multiple dex files define.

My error message is as follows:

1 [2015-06-11 09:54:32 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/protobuf/AbstractMessage$1;2 [2015-06-11 09:54:32 - SharePDF] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/protobuf/AbstractMessage$1;

Check the lib directory and find the problem and solution.Both jar packages contain google. protobuf, Try to delete google. protobuf in one of the jar packages and find that the compilation is successful.

1 [2015-06-11 10:10:45 - SharePDF] Dx 2 trouble writing output: already prepared

But !!!!!

At run timeClass not find,Then try to replace it with the retained package and delete the other jar package. The package is compiled and runs successfully.

I think it is: Third-Party jar Packages may associate some classes during production, and direct deletion may cause errors. In this case of class conflicts in the jar package, you cannot delete one of them at will, but you must check whether there is any association that causes other classes to become unavailable.

 

"Here, I would like to ask what the association relationship is like. I am not very familiar with compilation and dx.

 

Other online solutions:

Method 1:
Eclipse-> Project-> remove Build Automatically-> Clear-> Build Project-> Build Automatically, close Eclipse, and open it again (I tried not to solve this problem)

Method 2:
Update the ADT plug-in and delete the. metadata directory under the workspace directory (not tried)

Method 3:
In a folder under your project, there is a file with the suffix *. APK. Delete it and restart Eclipse. (Not tried)

Method 4:
The reason is that there are duplicates. Jar is referenced. You can view your build path. In particular, Android Dependencies must have repeatedly introduced. jar packages. The solution is to delete duplicate jar files in libs. (This is not the case)

Method 5:
In the project, the package name of a class is the same as the class in the referenced jar package. If the class in the jar package is used, the class in the project is referenced repeatedly, after you delete a class that is referenced repeatedly in the project, it is packaged and started. (My situation is similar to this, but the classes and package names in the two jar packages are consistent or conflicted)

 

Http://blog.csdn.net/mxlxiao7/article/details/8978930 ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.