I am developing an App in Android. It has to be able of take a photo, and to send that photo to a webpage. This is the code:
HttpClient httpclient = new Defa
I solved the same issue like this:
Open pom.xml in the project you are facing this
java.lang.NoClassDefFoundError: org/apache/http/entity/mime/MultipartEntityBuilder
Under dependencies, add this piece of code.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.2</version>
<scope>test</scope>
</dependency>
Clean and rebuild the code.
It will work.
Open Properties for your project in Eclipse. And open Order and Export, make sure all libraries you need are selected. And click Project>clean. Finally, your problem should be gone.
you need create a folder named libs
in your project, and copy you referenced jars to this folder.
Being unsuccessful at the automatic updating thing, I downloaded the latest and greatest. But the MultipartEntity class couldn't be found. I re-added it to the project. I made sure it was in a folder called 'libs' - but no luck. Andong's prompted me to check the project preferences. Project Properties -> Java Build Path -> Order and Export: make sure that Android Private Libraries is checked. (I checked them all). Clean your project. The problem is gone.
So weird, my app already had the files in "lib" and got this crash. I renamed it "libs" following idiottiger's response and it worked.
I had a few issues with this today:
a) I had all the jar files to the libs directory and went right click on Project > Build Path > Add external jars > selected the jar files. Then went "order and export", still got the issue. b) Turns out that httpclient-4.3.1.jar and httpmime-4.3.1.jar weren't enough. I needed to add httpcore-4.3.jar as well.
That got rid of the error! :D I have spent nearly 4 hours today trying to fix this :(