Hello,
I am trying to add a simple JNI function call to the androidEmptyExample and it is not working. Can somebody please help me. I will post the code I added.
in OFActivity:
package cc.openframeworks.androidEmptyExample;
public class OFActivity extends cc.openframeworks.OFActivity{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
String packageName = getPackageName();
this.testJNI();
ofApp = new OFAndroid(packageName,this);
}
public native void testJNI();
main.cpp:
#include "ofMain.h"
#include "ofApp.h"
int main(){
ofSetupOpenGL(1024,768, OF_WINDOW);
ofRunApp( new ofApp() );
return 0;
}
#ifdef TARGET_ANDROID
#include <jni.h>
extern "C"{
void Java_cc_openframeworks_OFAndroid_init( JNIEnv* env, jobject thiz ){
main();
}
}
extern "C"{
void Java_cc_openframeworks_androidEmptyExample_OFActivity_testJNI( JNIEnv* env, jobject thiz ){
int a = 3;
}
}
#endif
This is the logcat output i get:
12-29 14:19:24.210: E/AndroidRuntime(3206): FATAL EXCEPTION: main
12-29 14:19:24.210: E/AndroidRuntime(3206): java.lang.UnsatisfiedLinkError: Native method not found: cc.openframeworks.androidEmptyExample.OFActivity.testJNI:()V
Do I have to add something in another file or why is it not working?
Regards,
Karl