1. Question
When I use httpclient.jar, httpcore.jar and httpmime.jar in my APP development for Android, I encountered below several errors during the APP runs on Android4.4 device.
(1) Could not find class 'javax.naming.ldap.LdapName'
(2) java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE
(3) java.lang.VerifyError: org/apache/http/conn/ssl/DefaultHostnameVerifier
2. Analysis:
Through analyzing the debug log, I can confirm all these errors occurred during creating the httpclient object.
3. Resolution
Firstly, we should choose the proper and compatible versions of corresponding three jars. I finally use httpclient-4.3.6.jar, httpmime-4.3.6.jar, and httpcore-4.3.3.jar.
Secondly, use DefaultHttpClient() function to get a HttpClient object.
4. Summarize knowledge
httpclient/httpcore/httpmime these three tools are already nearly abandoned in current Java and Android version, so it is not recommended to use them in your new project. If necessary, you should keep the versions compatible, and choose proper invoke functions.