Getting "Unable to execute dex: Multiple dex files define" error when trying to run main project which is using other library project
Asked Answered
L

3

2

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.

Lexicology answered 16/5, 2013 at 10:20 Comment(1)
Please check this link .this may help you #7870765Cadelle
B
3

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

Baxley answered 29/4, 2014 at 5:46 Comment(0)
D
1

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..

Ducan answered 16/5, 2013 at 12:9 Comment(0)
D
0

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.

Declarative answered 15/7, 2016 at 8:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.