简体   繁体   English

使用自定义Java库的Android ClassNotFoundException

[英]Android ClassNotFoundException on using custom java library

I am using my own custom java library to read response from the server by hitting urls. 我正在使用自己的自定义Java库,通过点击url从服务器读取响应。 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. 我编写了一个独立的Java程序来检查该库是否正在运行,并且我对所有URL都获得了肯定的答复。 But when I am trying to use the same java library with my android code it is throwing me an exception. 但是,当我尝试在我的android代码中使用相同的java库时,会抛出异常。

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: 您可能想在Java构建路径中导出库:

See Android - Unable to instantiate activity - Class not found exception after upgrading to ADT 22 请参阅Android-无法实例化活动-升级到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) . 编辑在您的自定义库项目中,确保在Java Build路径中导出Apache库( 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. 因此,转到您的自定义库项目,并确保已导出Apache库。 If it is, raise it up in the list in order of export. 如果是,请按导出顺序在列表中将其升高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 CameraX 库 android 时崩溃:java.lang.ClassNotFoundException - Crash using CameraX library android: java.lang.ClassNotFoundException 使用actionbarsherlock库的Android ClassNotFoundException - Android ClassNotFoundException using actionbarsherlock library 自定义库上的java.lang.ClassNotFoundException - java.lang.ClassNotFoundException on custom library Android库项目上的java.lang.ClassNotFoundException - java.lang.ClassNotFoundException on Android Library Project java.lang.ClassNotFoundException 绑定 Xamarin.ZE84E30B9390CDB486DZDB67 中的 java 库 - java.lang.ClassNotFoundException binding java library in Xamarin.Android Android-库xmlns的ClassNotFoundException - Android - ClassNotFoundException for library xmlns Android:使用具有gradle依赖项的库项目时,ClassNotFoundException - Android: ClassNotFoundException when using library project that has gradle dependencies 在 Android 应用程序中自定义 ImageView 的 ClassNotFoundException - ClassNotFoundException for custom ImageView in Android app Android:java.lang.ClassNotFoundException - Android: java.lang.ClassNotFoundException Java / Android Bouncy城​​堡ClassNotFoundException - Java/Android Bouncy castle ClassNotFoundException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM