I'm trying to use a Java library jar on Android that uses
java.lang.NoSuchMethodError: No virtual method ensureClassInitialized(Ljava/lang/Class;)V in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)
Any ideas, how I can use the library jar on Android?
There is a Android version of
sun.misc.Unsafe (see here), but it doesn't include that particular method. (I assume that the method was introduced in Java 7 ...)
Using the OpenJDK version of
Unsafe on Dalvik / Android won't work, because it depends on native methods that are not implemented by the Dalvik VM. (And it looks like you didn't even manage to get Davlik to load the OpenJDK version instead of the Android version.)
Note that some
Unsafe methods will be usable on Android... but only the ones in the version of the class I linked to.