Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android java.lang.VerifyError?

In my Android app, I always get VerifyErrors! And I cannot figure out why. Whenever I include a external JAR, I always get VerifyErrors when I try to launch my app (except for once, when I included Apache Log4j.)

I usually get around this by taking the source of the library and adding it to my project, but I am trying to put the GData client library.

I can get this in source, but it's dependencies (mail.jar, activation.jar, servlet-api.jar) I cannot, so I get verify errors. I would like to get to the root of this problem once and for all. I looked on the internet, but they all seem to talk about incomplete class files? which I do not know of.

like image 218
Isaac Waller Avatar asked Mar 21 '09 05:03

Isaac Waller


3 Answers

Look at LogCat and see what's causing the verifyerror. It's probably some method in a java.lang class that is not supported on the android SDK level you are using (for instance, String.isEmpty()).

like image 170
Alex Avatar answered Oct 31 '22 06:10

Alex


From android-developers:

The output from "adb logcat" indicates the class that could not be found as well as the class that has the bad reference. The location is identified down to the specific Dalvik instruction. The trick is to look in the logs above the exception.

like image 44
ADB Avatar answered Oct 31 '22 07:10

ADB


Android uses a different class file format. Are you running the 3rd party JAR files through the "dx" tool that ships with the Android SDK?

like image 35
TofuBeer Avatar answered Oct 31 '22 08:10

TofuBeer