android项目在add第三方jar包之后,报错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android项目在add第三方jar包之后,报错相关的知识,希望对你有一定的参考价值。
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.log4j.chainsaw.ControlPanel$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.
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.log4j.chainsaw.ControlPanel$2) 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.
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.log4j.chainsaw.ControlPanel$3) 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.
一部分,还有很多,最后
Dx 1 error; aborting
Conversion to Dalvik format failed with error 1
纠结,试了很多方法,都不行,求高手解答
如何引入第三方jar包
andriod中如果引入jar包的方式不对就会出现一些奇怪的错误。工作的时候恰好有一个jar包需要调用,结果用了很长时间才解决出现的bug。
刚开始是这样引用的(eclipse):
右键工程,Build path,java build path,
选择libraries,在右边的按钮中点击“Add External JARs”,
然后选择合适的jar包(大部分人应该会这样做).
结果控制台立刻报错:conversion to dalvik format failed with error 1。
而且项目上还会出现红叉,虽然项目里并没有错误。
clean一下,项目正常,但是bin里的apk文件和dex文件都没了,运行项目出现错误:Can not find **.apk后来找到原因是因为导入jar包的方式不对,
正确的方法如下:
1,右键工程, Build path, java build path,
2,选择libraries在右边的按钮中点击“Add Library”
3,选择“User library”,点击“下一步”
4,点击“User librarys”按钮在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
5,点击“Add jars”按钮选择第三方jar包,
点击“确定”完成操作。这样的话该jar包会被一起打包到apk中,问题也就解决了! 参考技术A 下载相应的jar包,复制到WebContent/WEB-INF/lib文件夹下,就可以了
以上是关于android项目在add第三方jar包之后,报错的主要内容,如果未能解决你的问题,请参考以下文章