简体   繁体   English

Android:从“ java”库扩展的类的java.lang.NoClassDefFoundError

[英]Android: java.lang.NoClassDefFoundError for class extended from “java” library

Following is the snap shot of the eclipse's package explorer. 以下是Eclipse的软件包浏览器的快照。 I use the opencsv library for the app project. 我将opencsv库用于该应用程序项目。 I added the jar to referenced libraries in main project. 我将jar添加到主项目中的引用库中。 I define a class 'X' in main project that extends a class from the jar library project. 我在主项目中定义了一个类'X',该类扩展了jar库项目中的一个类。

When I create an instance of class 'X' it gives 当我创建类“ X”的实例时,它给出了

java.lang.NoClassDefFoundError

I tried to add the library in Properties>Android>Add... but since the opencsv is a java project and not android library project, it doesnt show up in the list to select. 我试图在“ 属性”>“ Android”>“添加...”中添加该库,但是由于opencsv是一个Java项目而不是android库项目,因此它不会显示在要选择的列表中。

Somehting missing? 缺少什么?

在此处输入图片说明

Did you mark that library for export? 您是否将该库标记为要导出? Properties->Java Build Path->Order and Export? 属性-> Java构建路径->命令和导出?

check private libraries and dependancies as export entities for your library project. 检查私人图书馆和依存关系作为图书馆项目的出口实体。 see this attachment 看到这个附件 点击这里

You have here 2 possibilities: 您有2种可能:

  1. Transform you opencv project into android library project and bind it as library in your main project 将您的opencv项目转换为android库项目,并将其作为库绑定到您的主项目中

  2. Copy & paste the openCSV-2.3.jar in the libs folder from your main project. 将openCSV-2.3.jar复制并粘贴到主项目的libs文件夹中。 It will apprears automatically in references libraries 它将在references libraries自动评估

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

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