Android & Eclipse java.lang.VerifyError问题

摘要:Android & Eclipse java.lang.VerifyError问题


我正在跑

https://github.com/tokudu/AndroidPushNotificationsDemo

所给的程序,

然后复制到Eclipse,新开项目底下,

并且在Android手机上测试,

但经由LogCat查看,会发生Not Found Class 及VerfiyError问题

经Google后。

找到经篇相关问题的文章。

Android项目更换开发环境时出现的java.lang.VerifyError 异常解决办法

http://blog.csdn.net/wudiwo/article/details/7548451

扫描二维码关注公众号,回复: 7247749 查看本文章

http://stackoverflow.com/questions/3642928/adding-a-library-jar-to-an-eclipse-android-project

其一原因是:

1. 大多数可能引用的外部jar文档出现了问题,比如说package的路径产生了问题,但该类被class文档定义了。
2. 调用了一些编译器产生异议的问题,可能是使用的sdk版本不同,但源代码是一些更老版本的定义。
3、java.lang.VerifyError 是说当“校验器”检测到一个类文档虽然格式正确,但包含着一些内部不一致性或安全性问题时,抛出该错误。这个是有jdk版本

但好像不是这个问题
其二解法是
Jar档并没有载入。
那就要用第二个连结的解答
1.Download the library to your host development system.
2.Create a new folder, libs, in your Eclipse/Android project.
3.Right-click libs and choose Import -> General -> File System, then Next, Browse in the filesystem to find the library's parent directory (i.e.: where you downloaded it to).
4.Click OK, then click the directory name (not the checkbox) in the left pane, then check the relevant JAR in the right pane. This puts the library into your project (physically).
5.Right-click on your project, choose Build Path -> Configure Build Path, then click the Libraries tab, then Add JARs..., navigate to your new JAR in the libs directory and add it. (This, incidentally, is the moment at which your new JAR is converted for use on Android.)

我实机操作的话顺序如下:
1.Eclipse,建立项目后,其实已经有libs数据夹,所以在libs数据夹,按右键/Import/
2.选择General/File System/
3.Next,
4.Browse,去找有该jar档的目录后,左边是该目录,右边是里面拥有的文件数据,将wmqtt.jar 勾选checkbox加入后,按Finish
5.接着,选择项目AndroidDemo,右键,Build Path / Configure Build Path / 点选 Libraries ,点选Add JARs 选择AndroidDemo/libs/wmqtt.jar,
6.开始run 到device,结果原本的错误消息就没有了(可惜又有新的,待解)



原文:大专栏  Android & Eclipse java.lang.VerifyError问题


猜你喜欢

转载自www.cnblogs.com/chinatrump/p/11496730.html