1

I am using the following line of code

    ByteArrayBody bab = new ByteArrayBody(data, "/mnt/sdcard/p270.jpg");

It is throwing the following exemption

    05-30 18:28:17.128: E/AndroidRuntime(5549): java.lang.NoClassDefFoundError: org.apache.http.entity.mime.content.ByteArrayBody

I have referenced http-mime-4.1.2.jar ( deleted it and downloaded again today). I have also cleaned the project and rebuild it. I still keep getting the same error.

I am using Android 4.04 and Eclipse.

Any suggestions?

user813813
  • 303
  • 1
  • 5
  • 24

2 Answers2

0

Hi this Link would help you to solve your problem, it occurs when you update the sdk. Including the library files to libs folder automatically gets referenced in the latest android sdk

Community
  • 1
  • 1
Dinash
  • 2,908
  • 4
  • 30
  • 45
  • Thanks, I have the .jar file in the lib folder of my project and added it to the build path from there. – user813813 May 30 '12 at 17:47
  • Yes it would working fine with the older ADT's and after updating them it will not be working, just remove the jars from build path and then rename the lib folder to libs. You can see the class files getting referenced automatically. – Dinash May 30 '12 at 17:57
  • This is what I did, I removed the lib from the build path. Shut down Eclipse, renamed the Lib folder to Libs, and opened the Eclipse project again. Then from the libs folder in Eclipse, I added the http-mime-4.1.2.jar to the build path by using right click. I am still getting the same error. Did I do this properly? – user813813 May 30 '12 at 18:11
0

Copy the jar(s) to the libs directory in the project. Do not rename the lib folder. just close eclipse, create new folder libs under the main folder of your project, copy the jars in the libs directory, open eclipse, use right click on the libs folder (this time inside eclipse) and select REFRESH and your added jars will appear. Then run the project. In my case it worked.

Gaucho
  • 1,298
  • 1
  • 17
  • 32