3

In search of a way to upload an image, I added a lot of external JARs following this simple explanation:using-multipartentity-in-android-applications
But when I try co compile the code I'm getting an error:

[2012-12-14 11:37:55 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/http/ConnectionClosedException;

I have never used external libraries before. Can someone tell me how to fix that?

Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100
Droidman
  • 11,485
  • 17
  • 93
  • 141

3 Answers3

4

The same class/classes may be defined in multiple libraries. That's why you are getting this error. You need to check which classes are overlapping and resolve the issue by re-organizing or removing some external libraries.

It might also be an eclipse issue. Try cleaning your project.

See the following threads:

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

Unable to execute dex: Multiple dex files define

Error when building apk - "Multiple dex files define Lcom/google/ads/Ad"

Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
1

If you type

org.apache.http.auth.AUTH auth;

somewhere in your code, then select the AUTH part, right click it and hit Declarations > Workspace, you'll where this class is declared. It's in android.jar, but in my project it was also in two separate versions of httpclient-4.x.x.jar (one had got added in as a dependency of another part of the project).

Removing the earlier version of httpclient-4.x.x.jar seems to have fixed this for me; you may find you have multiple libraries included in your project that declare this class (other than android.jar) and removing one or more will help too.

Andrew Wyld
  • 7,133
  • 7
  • 54
  • 96
0

Right click the src and gen folders and select Build Path > Remove from Build Path. then Right Click > Build Path > Use as Source Folder

Cirem
  • 840
  • 1
  • 11
  • 15