Xpring4J Android Support

Hi all!

I am trying to use the latest Xpring4J (6.0.1) for an Android application but the app crashes when it tries to initialize a wallet during runtime with the following error:

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 /apex/com.android.runtime/javalib/core-oj.jar)
E/flutter (11409): at com.oracle.truffle.api.library.LibraryFactory.ensureLibraryInitialized(LibraryFactory.java:306)
E/flutter (11409): at com.oracle.truffle.api.library.LibraryFactory.getUncached(LibraryFactory.java:287)
E/flutter (11409): at com.oracle.truffle.api.library.LibraryFactory.(LibraryFactory.java:177)
E/flutter (11409): at com.oracle.truffle.api.interop.InteropLibraryGen.(InteropLibraryGen.java:129)
E/flutter (11409): at com.oracle.truffle.api.interop.InteropLibraryGen.(InteropLibraryGen.java:120)
E/flutter (11409): at java.lang.Class.classForName(Native Method)
E/flutter (11409): at java.lang.Class.forName(Class.java:454)
E/flutter (11409): at com.oracle.truffle.api.library.LibraryFactory.loadGeneratedClass(LibraryFactory.java:636)
E/flutter (11409): at com.oracle.truffle.api.library.LibraryFactory.resolveImpl(LibraryFactory.java:599)
E/flutter (11409): at com.oracle.truffle.api.library.LibraryFactory.resolve(LibraryFactory.java:592)
E/flutter (11409): at com.oracle.truffle.api.interop.InteropLibrary.(InteropLibrary.java:1547)
E/flutter (11409): at com.oracle.truffle.api.interop.InteropLibrary.getFactory(InteropLibrary.java:1533)
E/flutter (11409): at com.oracle.truffle.polyglot.PolyglotValue.(PolyglotValue.java:123)
E/flutter (11409): at com.oracle.truffle.polyglot.PolyglotValue.createHostNull(PolyglotValue.java:941)
E/flutter (11409): at com.oracle.truffle.polyglot.PolyglotImpl.initialize(PolyglotImpl.java:119)
E/flutter (11409): at org.graalvm.polyglot.impl.AbstractPolyglotImpl.setConstructors(AbstractPolyglotImpl.java:208)
E/flutter (11409): at org.graalvm.polyglot.Engine$1.run(Engine.java:723)
E/flutter (11409): at org.graalvm.polyglot.Engine$1.run(Engine.java:691)
E/flutter (11409): at java.security.AccessController.doPrivileged(AccessController.java:43)
E/flutter (11409): at org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:691)
E/flutter (11409): at org.graalvm.polyglot.Engine.access$000(Engine.java:105)
E/flutter (11409): at org.graalvm.polyglot.Engine$ImplHolder.(Engine.java:114)
E/flutter (11409): at org.graalvm.polyglot.Engine$ImplHolder.access$100(Engine.java:113)
E/flutter (11409): at org.graalvm.polyglot.Engine.getImpl(Engine.java:287)
E/flutter (11409): at org.graalvm.polyglot.Engine$Builder.build(Engine.java:525)
E/flutter (11409): at org.graalvm.polyglot.Context$Builder.build(Context.java:1489)
E/flutter (11409): at org.graalvm.polyglot.Context.create(Context.java:710)
E/flutter (11409): at io.xpring.xrpl.javascript.JavaScriptLoader.(JavaScriptLoader.java:39)

So two questions:

  1. Does Xpring4J work with Android at all?
  2. If it does, am I missing some dependency?
1 Like

I’m not immediately sure of our Android compatibility but we definitely want to be.

I’m going to follow up and investigate but it’ll take a bit of time to get an environment up and running and properly investigate.

Hey, I’m facing the same issue. Is there any new information regarding this?