Search code examples
androidjava-native-interface

JNI tech. on Android or Linux platform when development ,so?


I face a problem while developing a native C/C++ shared library for Android platform. As we all know that Android use Java language for the upper layer development. Now I have ported my Engine code using ASCII C/C++ to Android using its bionic library, yet when need to design the User Interface, I have to use the JNI to call my engine code.

As far as I know, that is the only choice. The problem is my engine own hundreds of export APIs. If I use the JNI tech. I need to wrap these APIs to a new shared library for use, which will cost a lot of time for development and testing.

Can somebody give some suggestions for this situation? I am not familiar with java or JNI tech by the way.

TIPS:

When I searched the internet, I found some open source for JNI generator such as JNative etc. Until now I do not know is it suitable for Android platform or not.


Solution

  • You can easily use SWIG www.swig.org which will generate the JNI bindings for you. there is nothing android-specific in that operation, so it will work rather out-of-the-box.