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 (http://code.google.com/p/gdata-java-client/). 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.
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?
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()).
I get the VerfiyError as well... can't find a real reason. It helps to wrap the new lines of code into a method (Eclipse, 'Extract Method...'). So in my case the reason is not an unsupported method.
It happened to me right now. The error was caused because I was using methods from a newer SDK that my device had.
Android 1.5 device installed an apk using this:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
I Have the Same Problem. I have made an Android app, and compiled it with Android 1.6 sdk. It works great on my G1 with Android 1.6 But with the HTC Hero with Android 1.5 I get java.lang.VerifyError
I guess thats the problem !
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.