I have a large Java code (only calculation functions, no UI) that I want to reuse as a static library in iOS. My approach was to use robovm and follow an unofficial way to create a static library, described in two articles on the robovm forum: 1 Basic method and 2 Updated version
Trying to follow the steps exactly as described, I got stuck, unfortunately, after creating a shared library using a script, linking the library (.a) in Xcode and successfully creating the project.
At runtime, I see that my C ++ bridge code is being called, but JNI is accessing the library with BAD_ACCESS. For example, the following line of alarms:
jclass myJavaClass = jniEnv->FindClass("com/test/robovm/bridge/MyJavaRoboCode");
in this method:
void callSomethingInJava(const char* arg) {
}
The same is true if I try to use rvmXX methods directly instead of JNI and try to access something in my Java classes. It seems that rvmEnv is not fully initialized. (I double checked for package name or typo errors).
It would be great if someone already managed to create a shared static library from the robovm project and could share their experience here or point me in the right direction to solve the problem.
java objective-c jni static-libraries robovm
wfrank Jul 29 '14 at 15:59 2014-07-29 15:59
source share