Jni issues - No implementation found

im trying to call a native method implemented in c++ with the jni and all compiles fine but at runtime i keep getting

11-01 07:47:07.757: D/dalvikvm(20711): Added shared lib /mnt/asec/cc.openframeworks.jamNews-1/lib/libOFAndroidApp_neon.so 0x41eb3568
11-01 07:47:07.757: I/(20711): JNI_OnLoad called
11-01 07:47:07.758: I/OF(20711): initializing app
11-01 07:47:07.758: I/OF(20711): OFAndroid init...
11-01 07:47:07.777: D/dalvikvm(20711): create interp thread : stack size=128KB
11-01 07:47:07.777: D/dalvikvm(20711): create new thread
11-01 07:47:07.844: D/dalvikvm(20711): new thread created
11-01 07:47:07.844: D/dalvikvm(20711): update thread list
11-01 07:47:07.845: D/dalvikvm(20711): threadid=12: interp stack at 0x552f5000
11-01 07:47:07.845: D/dalvikvm(20711): init ref table
11-01 07:47:07.845: D/dalvikvm(20711): init mutex
11-01 07:47:07.845: D/dalvikvm(20711): threadid=12: created from interp
11-01 07:47:07.845: D/dalvikvm(20711): start new thread
11-01 07:47:07.846: D/dalvikvm(20711): create interp thread : stack size=128KB
11-01 07:47:07.846: D/dalvikvm(20711): create new thread
11-01 07:47:07.846: D/dalvikvm(20711): new thread created
11-01 07:47:07.846: D/dalvikvm(20711): update thread list
11-01 07:47:07.847: D/dalvikvm(20711): threadid=12: notify debugger
11-01 07:47:07.847: D/dalvikvm(20711): threadid=12 (Thread-11410): calling run()
11-01 07:47:07.847: I/OF(20711): starting resources extractor
11-01 07:47:07.857: D/dalvikvm(20711): threadid=13: interp stack at 0x55417000
11-01 07:47:07.858: D/dalvikvm(20711): init ref table
11-01 07:47:07.858: D/dalvikvm(20711): init mutex
11-01 07:47:07.858: D/dalvikvm(20711): threadid=13: created from interp
11-01 07:47:07.859: D/dalvikvm(20711): start new thread
11-01 07:47:07.859: W/dalvikvm(20711): No implementation found for native Lcc/openframeworks/jamNews/OFActivity;.something:()V
11-01 07:47:07.859: D/dalvikvm(20711): threadid=13: notify debugger
11-01 07:47:07.859: D/dalvikvm(20711): threadid=13 (Thread-11411): calling run()
11-01 07:47:07.861: I/OF(20711): joining
11-01 07:47:07.906: I/OF(20711): sd mounted: true
11-01 07:47:07.907: I/OF(20711): creating app directory: /storage/sdcard0/Android/data/cc.openframeworks.jamNews/files
11-01 07:47:07.910: I/ofAppAndroidWindow(20711): setting app dir name to: "/storage/sdcard0/Android/data/cc.openframeworks.jamNews/files"
11-01 07:47:07.920: D/AndroidRuntime(20711): Shutting down VM
11-01 07:47:07.920: W/dalvikvm(20711): threadid=1: thread exiting with uncaught exception (group=0x418f5ce0)
11-01 07:47:07.920: W/dalvikvm(20711): threadid=1: uncaught exception occurred
11-01 07:47:07.921: W/System.err(20711): java.lang.UnsatisfiedLinkError: Native method not found: cc.openframeworks.jamNews.OFActivity.something:()V
11-01 07:47:07.930: W/System.err(20711):     at cc.openframeworks.jamNews.OFActivity.something(Native Method)
11-01 07:47:07.931: W/System.err(20711):     at cc.openframeworks.jamNews.OFActivity.onCreate(OFActivity.java:21)
11-01 07:47:07.931: W/System.err(20711):     at android.app.Activity.performCreate(Activity.java:5264)
11-01 07:47:07.931: W/System.err(20711):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
11-01 07:47:07.931: W/System.err(20711):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
11-01 07:47:07.931: W/System.err(20711):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
11-01 07:47:07.931: W/System.err(20711):     at android.app.ActivityThread.access$800(ActivityThread.java:151)
11-01 07:47:07.931: W/System.err(20711):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
11-01 07:47:07.932: W/System.err(20711):     at android.os.Handler.dispatchMessage(Handler.java:110)
11-01 07:47:07.932: W/System.err(20711):     at android.os.Looper.loop(Looper.java:193)
11-01 07:47:07.932: W/System.err(20711):     at android.app.ActivityThread.main(ActivityThread.java:5299)
11-01 07:47:07.932: W/System.err(20711):     at java.lang.reflect.Method.invokeNative(Native Method)
11-01 07:47:07.932: W/System.err(20711):     at java.lang.reflect.Method.invoke(Method.java:515)
11-01 07:47:07.932: W/System.err(20711):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
11-01 07:47:07.932: W/System.err(20711):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
11-01 07:47:07.932: W/System.err(20711):     at dalvik.system.NativeStart.main(Native Method)
11-01 07:47:07.935: W/dalvikvm(20711): threadid=1: calling UncaughtExceptionHandler
11-01 07:47:07.952: I/OF(20711): app name: jam news
11-01 07:47:07.952: D/dalvikvm(20711): threadid=12: exiting
11-01 07:47:07.952: D/dalvikvm(20711): threadid=12: bye!
11-01 07:47:07.953: I/OF(20711): joined
11-01 07:47:07.953: D/dalvikvm(20711): threadid=13: exiting
11-01 07:47:07.953: D/dalvikvm(20711): threadid=13: bye!
11-01 07:47:07.954: E/AndroidRuntime(20711): FATAL EXCEPTION: main
11-01 07:47:07.954: E/AndroidRuntime(20711): Process: cc.openframeworks.jamNews, PID: 20711
11-01 07:47:07.954: E/AndroidRuntime(20711): java.lang.UnsatisfiedLinkError: Native method not found: cc.openframeworks.jamNews.OFActivity.something:()V
11-01 07:47:07.954: E/AndroidRuntime(20711):     at cc.openframeworks.jamNews.OFActivity.something(Native Method)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at cc.openframeworks.jamNews.OFActivity.onCreate(OFActivity.java:21)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.Activity.performCreate(Activity.java:5264)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.ActivityThread.access$800(ActivityThread.java:151)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.os.Handler.dispatchMessage(Handler.java:110)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.os.Looper.loop(Looper.java:193)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at android.app.ActivityThread.main(ActivityThread.java:5299)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at java.lang.reflect.Method.invokeNative(Native Method)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at java.lang.reflect.Method.invoke(Method.java:515)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
11-01 07:47:07.954: E/AndroidRuntime(20711):     at dalvik.system.NativeStart.main(Native Method)

My implementation

extern "C"{
        
        
    jstring java_cc_openframeworks_jamNews_OFActivity_getContent(JNIEnv* env, jclass thiz){
                                                      
        return env->NewStringUTF(ScrapeApi::getContent().c_str());
        
        }
        
    void java_cc_openframeworks_jamNews_OFActivity_loadFeed(JNIEnv*  env, jclass  thiz, jstring pub, jstring cat){
        
            const char *publisher = env->GetStringUTFChars(pub, 0);
            const char *category = env->GetStringUTFChars(cat, 0);
        
        ScrapeApi::loadFeed(publisher, category);
    //Do something with the nativeString
 
    //DON'T FORGET THIS LINE!!!
        env->ReleaseStringUTFChars(pub, publisher);
        env->ReleaseStringUTFChars( cat, category);
        }
        
    void java_cc_openframeworks_jamNews_OFActivity_loadContent(JNIEnv*  env, jclass  thiz, jstring pub, jstring URL){
        
        //Get the native string from javaString
        const char *publisher = env->GetStringUTFChars(pub, 0);
        const char *url = env->GetStringUTFChars(URL, 0);
        
        ScrapeApi::loadArticle(publisher, url);
    //Do something with the nativeString
 
    //DON'T FORGET THIS LINE!!!
        env->ReleaseStringUTFChars(pub, publisher);
        env->ReleaseStringUTFChars(URL, url);
    }
    
    
    void java_cc_openframeworks_jamNews_OFActivity_something(JNIEnv * env, jclass thiz){
        
        cout<<"something"<<endl;
        
        }
    
    
}

function definitions in java

    public static native void loadFeed(String pub, String cat);
    public static native void loadContent(String pub, String url);
    public static native void something();
    public static native String getContent();

any help would be appreciated

i t hink the problem is that it needs to be Java_… instead of java_… with capital J

1 Like

thanks but just after posting i realized my error

Hii @kingwill101,
I am also getting this error can you tell me how you can resolved this ?