views:

225

answers:

1

I am trying to use a pre-existing native C library in my android project.. The library builds just fine with the NDK tools...

Now what I've come to understand is that I cannot just call into the library, but my library needs to include jni.h and add specific function declarations, like for example:

JNIEXPORT jint JNICALL Java_com_MultPkg_Mult_mult(JNIEnv *, jobject, jint, jint);

But since I'm using an existing library I that is also used on other platforms I don't like the idea of littering the whole code with these definitions that will only end up wrapping my real functions...

Is there a way around this? And if this really is the only way, is there any way to automatically generate these based on my existing C function declarations/definitions?

Much appreciated

+1  A: 

Use the javah tool that comes with your JDK as it's not part of the Android's SDK nor NDK.

Gregory Pakosz