Android java.lang.VerifyError?

Solution 1:

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()).

Solution 2:

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.

Solution 3:

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?

Solution 4:

To make it work you need to add jar of the library to one of the source folders (even if you have already added it as eclipse library, you still need to add it as source).

  1. Create a directory in your project (e.x. "libs") and put library jar there.
  2. Add the directory to the build class path by (click right button on the folder and select "Build path"->"Use as source folder").
  3. Rebuild your project.

Solution 5:

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"/>