Getting “Unable to execute dex: Multiple dex files define” error when trying to run main project which is using other library project

馋奶兔 提交于 2019-11-26 17:19:49

问题


I am trying use androidVNC open source project as a Library Project in my MainProject. androidVNC has also used ZoomerWithKeys library project. I want start a activity of androidVNC library project in my MainProject by clicking on a Button. I have done all the basic things like to define all the activity of library project in Manifest of main Project.

The problem is that i am getting following error when trying to running my MainProject - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/antlersoft/android/zoomer/R$drawable; [2013-05-16 15:44:03 - OtherProj] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/antlersoft/android/zoomer/R$drawable;

Thanks in advance.


回答1:


I resolve this by doing following steps:

  1. Go to bin folder of you app and see which libraries are duplicated(in mine I had 2 supportv4****)
  2. Hold your mouse on them and see where they compile from, keep in mind that you should keep the most important one, so if you are using appcompat and facebookSDK, you should keep that library which comes from appcompat
  3. Go to the properties of the project of the other library (e.g facebookSDK) -> Java build path -> Libraries and delete the dependency in which the buggy lib come from(in mine, supportV4 nested in Android Private Libraries, so I delete it), Also do it from a file manager, go to our project folder/libs and delete that buggy library if it's not cleaned by default
  4. In that window, after deleting, choose Add Jars... and select the library of the other project(in mine, I choose SupportV4 from appcompat)
  5. Clean you workspace, restart Eclipse

The problem should have gone, these steps work more than fine for me




回答2:


1).did you added your lib project to the main project?? Make sure..

2).also add the project to your lib project by doing this process--

In the lib project-->>right click on project-->>java build path-->>on the project tab-->>add your main project.

Now build your project..hopefully it will help you.

EDITED::

3). Go to the project properties..edit this(can give some space) and then save..clean project...then build..




回答3:


I tackled with this kind error in Android Studio.

In my case my main project was using two my own lib. But beside this those two libs were using the same library as external included
compile files('lib/external-lib.jar')

I solved it by doing following in my both own libs.

1)Removing old compile files('lib/external-lib.jar' ) from build.gradle and deleting old external_lib.jar from lib folder.

2)Adding library from jcenter() two my own libs
compile 'external.lib:1.9.2'

3)Rebuild.

Then rebuild and run main project

Then problem has disappeared.



来源:https://stackoverflow.com/questions/16584837/getting-unable-to-execute-dex-multiple-dex-files-define-error-when-trying-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!