简体   繁体   中英

Android ClassNotFoundException on using custom java library

I am using my own custom java library to read response from the server by hitting urls. I have written a standalone java program to check whether the library is working or not and I am getting the positive responses for all the urls. But when I am trying to use the same java library with my android code it is throwing me an exception.

Exception:
Could not find class 'org.apache.http.impl.conn.PoolingClientConnectionManager', referenced from method com.nq.client.comm.HttpClientHelper.<init>.
java.lang.NoClassDefFoundError: org.apache.http.impl.conn.PoolingClientConnectionManager

You probably want to export the library in your Java Build Path:

See Android - Unable to instantiate activity - Class not found exception after upgrading to ADT 22

EDIT In your custom library project, make sure you are exporting in the Java Build path the Apache library ( org.apache.http.impl.conn.PoolingClientConnectionManager) . The error message is telling you that there is a reference to this library, but it cannot be found. This means that it's not being packaged with the library that is referencing it. So, go to your custom library project and make sure that the Apache library is getting exported. If it is, raise it up in the list in order of export.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM