Home » Android » android – Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr

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

Posted by: admin June 15, 2020 Leave a comment

Questions:

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!

How to&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

Answer:

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.

Answer:

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.

Answer:

the issue for me was duplicate class files. i had both the package itself and the jar sdk of the package (in libs folder) in the same project.

Answer:

This happened to me after I changed a regular android project to a library project in order to use it for a Free/Paid project split set up.

Running either of the Free/Paid projects will result in OPs error.

Problem was some left over compilation stuff when the base project was a normal project and not a library project.
Just clean the workspace and rebuild all projects. Old compilation junk will be removed and everything will be compiled into correct libraries.
Try to rerun project which gave the error and everything should be fine now.

Answer:

Be sure both projects (the library and the app) don’t have the same packagename (within the AndroidManifest)

Answer:

I had the same issue today. I deleted the .apk file inside /bin, seemed to fix it.

Answer:

Remove all the libraries from Build Path and import the library project that you want to implement.. This works just fine..

Answer:

You can use Tattletale

It helps you to identify duplicated classes in your JAR files.

Hope it helps.

Answer:

For Android Studio – I removed duplicate .jar imports and it was resolved.

Details:
I had an app that had a base /common folder and then two folders that inherited from that – a free and paid version of the app. The issue was caused when I had the /common folder and the /free folder both including the same crashlytics jar file in project structure.

Answer:

For me, the solution was delete every JAR file in the “bin” folder / directory.

Answer:

If your project is referencing a library project – please check if the library project has the same libs that you are using in your project but different versions. Use same versions everywhere and all should be ok!