So I've been doing some research on how to run java code on an android device with dalvikvm. I can successfully run a java program compiled to a .dex file using the command dalvikvm -cp RunTest.dex RunTest
, where I have a RunTest class which has my main function. I've been pushing RunTest.dex and libeit_test.so (my native library) to /data/local/tmp, where I call the above command. My question is: Is there a way to package RunTest.dex and libeit_test.so into an apk, and run my program with the apk with something like dalvikvm -cp RunTest.apk RunTest
? I have been packaging my apk with ./dx --dex output=RunTest.apk RunTest.dex libeit_test.so
, but the program fails to run when I am calling dalvikvm -cp RunTest.apk RunTest
.
java.lang.NoClassDefFoundError: RunTest
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "RunTest" on path: DexPathList[[zip file "RunTest.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
The whole point of all of this is to push just one file to a device and run my test program. I'm trying to keep things as simple and minimalistic as possible.