I am trying to run Java applications on Android devices as standalone banks (and not as apk). It all started well: I used the dex compiler from the Android SDK, packed the dex file in a jar, pushed it to the device and used a shell script (similar to the example in the link) to run it.
When I included more libraries and pressed the 65x dex function restriction, I used the -multi-dex flag with the dex compiler. The compilation was successful, and I was also able to run my code on the Lollipop device. However, running the exact same jar on Kitkat gets the following exception at runtime:
java.lang.VerifyError: scala/None$
at akka.actor.ActorSystem$.<init>(ActorSystem.scala:30)
at akka.actor.ActorSystem$.<clinit>(ActorSystem.scala)
at akka.actor.ActorSystem.create(ActorSystem.scala)
at com.example.MyClass.calculate(MyClass.java:185)
at com.example.Main.main(Main.java:16)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
at dalvik.system.NativeStart.main(Native Method)
I ran into the same problem when I tried to use the same code as apk and solved it by adding a line to the Android manifest:
android:name="android.support.multidex.MultiDexApplication"
This is clearly not possible in the current situation, since I do not have a manifest file.
How can I enable multidex support for my standalone jar? Should I add libraries to compilation? Should I run the jar differently?
Thank.
source
share