Android Socialize SDK: Unable to execute dex: Multiple dex files define

21k Views Asked by At

I'm using Socialize SDK in my Android app project (API 18).

I have read its Getting Started documentation and followed the instruction on how to implement it.

However, I come across several problems regarding library imports. I've tried to put all the JAR files inside my project's /libs folder but it couldn't locate the drawables, because clearly I haven't include their /res folder.

So, I configured the Build Path of my project to include the Libraries. Now this error shows up:

[2013-11-20 10:11:04 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

[2013-11-20 10:11:04 - WebShopper] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

I have already imported Socialize project folder into Eclipse in order to use its libraries. But I couldn't figure out how to solve this error.

Here is how my Build Path currently looks like, if it helps:

Java Build Path

What's wrong with it? Are there any duplicated libraries I have to remove here?

If anything, please let me know.

6

There are 6 best solutions below

0
On BEST ANSWER

I don't know exactly what is the problem, it may be because of same class definition in multiple jar files. I also had same problem once but resolved it by removing one jar file from my lib folder.

Here is some links which may help you out in coming out of this problem

Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

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

0
On

For me the issue was that, i had added a lib project(autobahn lib) earlier and later switched the to Jar file of the same library.Though i had removed references to the older library project, i was getting this error. Following all the answers here i checked the build path etc. But i haven't added these libs to build path manually. So i had nothing to remove. Finally came across this folder.

bin/dexedLibs

I noticed that there were two jar files with the same name corresponding to autobahn Android which was causing the conflict. So i deleted all the jar files in the dexedLibs folder and rebuild the project. That resolved the issue.

0
On

Go to bin, dexedLibs of the project and delete the duplicate libs over there. The most common reason for this issue would be, a local version of the jar in the projects lib folder and in java build path the user may add the same jar again to the project. Which will reflect in the dexedLibs folder. Compiler wont be able to resolve the call to the exact class in this case. Delete the jars in the lib and in the dexedLibs. Clean and build.

0
On

I solved this exception by placing all the jar files in the same disk.

For Eg:D drive including your project workspace+jar files in the same drive.

0
On

Whenever you meet this problem, you must read the message. From literally,We can see you have same class file in you project that is android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.

If you can't find those two library repeated? You just need to make a new project, and copy all jar files to the new project /libs directory. Run as--->it error--->Then you delete some jar-->Build project--->Run as.Util you delete some jar,The project is Run as normally,Then you unzip the jar file,you will find the class in the error message. Now, you find out the two library, just to decide delete one.

0
On

This type of error occur because of multiple libraries or jar files in your project.Do the following:

  1. Delete the imported library first.
  2. Then clean your project.
  3. Go to project properties,then click on java build path, Library and then import jar.
  4. Then refresh your project and run again.

Hope this would help you..:)