Getting “Caused by: java.lang.VerifyError:”

[亡魂溺海] 提交于 2019-11-26 22:59:41
Cygni

In Eclipse, go to the Project properties -> Java Build Path. Select the Order and Export Tab and check your third party jars.

That can be caused by something in the jar accessing something in Java that's not in the Android SDK. Look in LogCat for the exception and it may tell you what it's missing. If you have the sources for the 3rd party jar, try including them directly into your project; that will help pin down the problem.

You also need to run your jar file through the "dx" tool that comes with the sdk.

If you are using ant, then you should add all your external jars to the following dir "libs" and also add following line in a new file: ant.properties: jar.libs.dir=libs

If you are getting a VerifyError after building a release version of your app using ProGuard, it might be related to some optimization issue. Refer to the documentation, which essentially suggests disabling optimization using -dontoptimize.

Removing all the jar files from the /libs folder and then adding them again followed by cleaning the project and building it fixed for me.

The same error occurred to me, as I tried to catch the exception SQLDataException on v.8 API device as the corresponding class is not included in the v.8 API (the error did not occur in v.14 devices, where that class is included). In fact, SQLDataException.class is not present only in the android.jar of v.8 API, while it is included in the v.14 API. So I replaced the exception SQLDataException with the exception SQLException (whose SQLDataException is a subclass) and my app now runs fine on both API's devices.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!