Reputation: 147
I have a native method in my Android Class as:
public native void decode(Bitmap pTarget, byte[] pSource);
When I try to create the header file using Eclipse Javah tool from Externla Configuration tools, I get a message that says:
Error: Cannot determine signature for Bitmap
This does not happen if I remove the native method declaration. How can I debug this issue to make sure javah can locate the signature for Bitmap?
Upvotes: 2
Views: 3050
Reputation: 333
The Bitmap
class belongs to the package "android.graphics.Bitmap", so its JNI type is Landroid/graphics/Bitmap;
The complete method signature should be:
void Java_yourPackage_yourClass_decode__Landroid_graphics_Bitmap_2_3B (JNIEnv *env, jobject thiz, jobject pTarget, jbyteArray pSource)
Sources: http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp615 http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/types.html
EDIT: the javah tool does not recognize Android classes, so you must add the classpath option to javah command. Try to look at this: https://stackoverflow.com/a/7635758/3370382
Upvotes: 3