Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr

I have created a library project for my app. When I try to add the library to a project, I get the following error when trying to run it:

[2013-02-07 04:51:26 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;
[2013-02-07 04:51:26 - testfromlibrary] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;

I have added the HoloEverywhere library to my library, whereas I have added the ActionBarSherlock library to HoloEverywhere. I am using Eclipse on Windows 7.

Even though I updated the SDK to the latest version, restarted Eclipse, and cleaned the various projects, the error persists.

Does anyone have any idea on how to solve this error? My bin dir is not included to the build path under properties, and I have tried deleting the bin folder altogether.

Thanks!

like image 317
Andreas H Avatar asked Feb 07 '13 02:02

Andreas H


3 Answers

I found that if I went into properties -> Java Build Path -> Order and Export and removed the Android Private Libraries then my project built fine. There was another support v4 jar in there which was conflicting with action bar sherlocks support v4 library

like image 199
Chriskot Avatar answered Nov 06 '22 20:11

Chriskot


This issue happens to me when I create a library in conjuction with actionbarsherlock. In this case the eclipse create the R from sherlock in my library and in the project using it.

The solution is delete in your library bin folder only the folder actionbarsherlock that contains the R classes. This inst create anymore, and is present only in your project app.

like image 35
thalespf Avatar answered Nov 06 '22 21:11

thalespf


I pinpointed the cause of the error to /bin/classes. If I deleted the /classes dir before running the app, the app would compile and run. Of course, when I tried to actually export the app, the /classes dir would come back and along with it the error.

The solution to my problem was to install the latest version of Eclipse. When I export or run the app through the latest installation of Eclipse, the /classes folder does not appear now.

like image 5
Andreas H Avatar answered Nov 06 '22 19:11

Andreas H