0
votes
  1. I have a C++ method I am trying to call from Java code
  2. the signature of the method is:

    • Java:
      public class FLVCamActivity extends Activity {
      static {
            System.loadLibrary("FLVCam");
            System.out.println("Loaded FLVCam");
      }
      public native void RunFlvServer(int iCamId);

    • C++:
      extern "C" JNIEXPORT void JNICALL Java_com_sophin_flvcam_FlvCamActivity_RunFlvServer(JNIEnv* env, jobject javaThis, jint iCamId)

  3. during runtime, System.loadLibrary("FLVCam") SUCCEEDs, but, invoking 'RunFlvServer' failed with "No implementation found for native Lcom/sophin/flvcam/FLVCamActivity;.RunFlvServer (I)V"
  4. The SDK Version I am using is: AndroidSDK=15, NDK=r7b, minsdk@manifest = 15
  5. using 'nm -g' to list all the export entries exposed by my native lib it clear that the native method is properly exported: 0006c0a8 T Java_com_sophin_flvcam_FlvCamActivity_RunFlvServer.

    Having the above in mind, why do I get this UnsatisfiedLink exception ?

Nadav at Sophin

1
How does Java native function declaration looks like? It should be in com.sophin.flvcam package, in FlvCamActivity class like this: "native void RunFlvServer(int iCamId)".Mārtiņš Možeiko
It is good to use javah command to great function header.Sudar Nimalan

1 Answers

0
votes

This was an Upper-case/Lower-case sort of thing, FLVCamActivity has 'FLV' in upper while the C++ method has 'Flv' ( Lower ), I wasted almost a day on that, Maan, I hope I'll use my time on real bugs next time.