android导入第三方jar后,产生:java.lang.NoClassDefFoundError错误

xiaogutougm 2011-09-22 09:12:43
导入poi的方法都是按照网上所说的,步骤:
右键工程,
Build path,
java build path,选择libraries
在右边的按钮中点击“Add Library”
选择“User library”,点击“下一步”
点击“User librarys”按钮
在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
点击“Add jars”按钮选择第三方jar包,点击“确定”完成操作。

但是,结果却是抛出了一个无法找到类的错误。
同时,也试了试下面的步骤:
右键工程--Build path---java build path-- add External Archives
结果更糟糕,整个eclipse都无法运行了!!
...全文
27843 45 打赏 收藏 转发到动态 举报
写回复
用AI写文章
45 条回复
切换为时间正序
请发表友善的回复…
发表回复
HeeLoo1 2014-06-09
  • 打赏
  • 举报
回复
怒谢11楼 @kjianjun
lollipop_woo 2014-05-20
  • 打赏
  • 举报
回复
华硕的不太严谨哈,我使用的ADT就到1.6
lollipop_woo 2014-05-20
  • 打赏
  • 举报
回复
我最近也遇到了这样的情况,但是估计和楼主的不太一样,我的第三方jar包是自己写的,生成jar包使用的是JDK1.7,但是安卓本身不支持JDK1.7,使用JDK1.6再次生成jar包就没再报那个错了,希望对你的问题有帮助。
Ada168855 2013-10-26
  • 打赏
  • 举报
回复
直接在项目中的src文件夹下创建一个用libs来命名的文件夹,然后把该项目所需要的jar文件直接复制到里面,这样应该就可以了,你先试试
zhansy_2013 2013-10-26
  • 打赏
  • 举报
回复
使用libs
ScunChen 2013-08-29
  • 打赏
  • 举报
回复
ADT更新后的bug。config path中勾上全部jar包就行。
kevinkai8001300559 2013-08-29
  • 打赏
  • 举报
回复
11楼正解,已经解决问题
ztm007 2013-07-16
  • 打赏
  • 举报
回复
谢谢31楼,问题解决了,搞了一天。。
ahacn 2013-07-07
  • 打赏
  • 举报
回复
31楼的是正确答案。
polic 2013-06-16
  • 打赏
  • 举报
回复
31 楼正解,问题解决了
Overlord 2013-05-27
  • 打赏
  • 举报
回复
引用 31 楼 Airforce_zhl 的回复:
我今天刚刚升级了ADT至22,也出现这个问题,折腾了半天,也在网上找了半天, 最后自己试出来了: 在java build path ->order and export 中勾选android private library 并置顶, 然后clean下工程,在编译运行就没错了。
这样确实可以了,编译后就正常了
灵动代码樵夫 2013-05-17
  • 打赏
  • 举报
回复
引用 31 楼 Airforce_zhl 的回复:
我今天刚刚升级了ADT至22,也出现这个问题,折腾了半天,也在网上找了半天,
最后自己试出来了:
在java build path ->order and export 中勾选android private library 并置顶,
然后clean下工程,在编译运行就没错了。


按你说的试了,不行啊!
Airforce-1 2013-05-16
  • 打赏
  • 举报
回复
其他的没有变,还是在项目根目录下新建"libs"把要引用的jar放进去就行了, 上个回复图片没有显示出来
Airforce-1 2013-05-16
  • 打赏
  • 举报
回复
我今天刚刚升级了ADT至22,也出现这个问题,折腾了半天,也在网上找了半天,
最后自己试出来了:
在java build path ->order and export 中勾选android private library 并置顶,
然后clean下工程,在编译运行就没错了。
无极工作室 2013-05-14
  • 打赏
  • 举报
回复
好像是poi对android的支持有问题,我也遇到这个问题,自己下了poi的源码重新生成了jar也还是不行!在dx的时候搞到myeclipse溢出直接崩溃。 看来再重新找其他支持office操作的库了,哪位大侠如果有解的话,麻烦帮回下:邮箱,weiliji@126.com 在下动感涕零,感激不尽。
Alex老夫子 2013-03-25
  • 打赏
  • 举报
回复
20楼正解,但是前提是要配置好环境哦,还有一种方法也可以解决这个问题, 1、在工程下新建lib文件夹,将需要的第三方包拷贝进来。 2、将引用的第三方包,添加进工作的build path。 3、(关键的一步)将lib设为源文件夹,即把lib文件夹放在src源文件目录里,如果不设置,则程序编译可以通过,但运行的时候,会报: java.lang.NoClassDefFoundError
顾小林 2013-03-15
  • 打赏
  • 举报
回复
Conversion to Dalvik format failed with error 1 你是不是 报这个错误 我最近也遇到你所说的问题了
su_xiaocheng 2013-03-14
  • 打赏
  • 举报
回复
20楼 正解
jiangjoexing 2012-12-19
  • 打赏
  • 举报
回复
我也遇到了这个问题,我导入的是poi的一下包,按照11楼的做法还是有问题, [2012-12-19 00:18:06 - GCIG] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.xmlbeans.impl.inst2xsd.util.Type$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. 这只是一部分。 trouble writing output: Too many methods: 91612; max is 65536. By package: 13 android.app 7 android.content ..... 下面一堆包类名称, 是不是导入的jar太大了???求解??
tomoroho 2012-08-29
  • 打赏
  • 举报
回复
11楼是正解
加载更多回复(24)

80,352

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧