For caching I use third-party DualCache library. When creating an instance of DualCache, the following error crashes.

java.lang.VerifyError: com/vincentbrison/openlibraries/android/dualcache/lib/DualCache 

What could be the problem?

Here is a link to the https://github.com/vincentbrison/android-easy-cache/blob/master/app/src/main/java/com/vincentbrison/openlibraries/android/dualcache/DemoActivity.java library

  • for example, you use the compiled jar file of this library, which is compiled for a different version of jdk. - KoVadim
  • You did not provide a link to the library or its description. Ask the author of the library what the problem is. - Vladyslav Matviienko
  • Added a link;) - Nina_slon

1 answer 1

The java.lang.VerifyError error occurs when the Android virtual machine - Dalvik VM cannot find the load code of an object of some class.

The fact is that Dalvik VM uses a slightly different format of object codes than that generated for JVM. There is a special utility dx that converts .class files into a .dex assembly (which is the Dalvik VM object manager).

In your case, why it happened so there may be several reasons. Maybe you just compiled .jar for the JVM and are trying to download it or maybe there is a problem with the dx version (included in Android Build Tools). Perhaps there is a problem with targetSdk in the manifest.

Look at your build.gradle and AndroidManifest.xml