0

I am working in CSipSimple . When I try to addBuddy , the following code is executed .

public int addBuddy(String buddyUri) throws SameThreadException {
        created = true ;
        if (!created) {
            return -1;
        }
        int[] p_buddy_id = new int[1];

        pjsua_buddy_config buddy_cfg = new pjsua_buddy_config();
        pjsua.buddy_config_default(buddy_cfg);
        buddy_cfg.setSubscribe(1);
        buddy_cfg.setUri(pjsua.pj_str_copy(buddyUri));

        pjsua.buddy_add(buddy_cfg, p_buddy_id);

        return p_buddy_id[0];
    }

The constructor of pjsua_buddy_config calls the following code :

public pjsua_buddy_config() {
    this(pjsuaJNI.new_pjsua_buddy_config(), true);
  }

At that time I got the following exception :

FATAL EXCEPTION: main
    Process: com.csipsimple, PID: 11070
    java.lang.UnsatisfiedLinkError: Native method not found: org.pjsip.pjsua.pjsuaJNI.new_pjsua_buddy_config:()J
            at org.pjsip.pjsua.pjsuaJNI.new_pjsua_buddy_config(Native Method)
            at org.pjsip.pjsua.pjsua_buddy_config.<init>(pjsua_buddy_config.java:64)
            at com.csipsimple.pjsip.PjSipService.addBuddy(PjSipService.java:1481)
            at com.csipsimple.service.SipService.addBuddy(SipService.java:1603)
            at com.csipsimple.ui.contacts.ContactFragment$1.onClick(ContactFragment.java:160)
            at android.view.View.performClick(View.java:4471)
            at android.view.View$PerformClick.run(View.java:18784)
            at android.os.Handler.handleCallback(Handler.java:808)
            at android.os.Handler.dispatchMessage(Handler.java:103)
            at android.os.Looper.loop(Looper.java:193)
            at android.app.ActivityThread.main(ActivityThread.java:5330)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
            at dalvik.system.NativeStart.main(Native Method)

I searched in the internet and found that this exception is due to the problem of loading of .so file . How can I solve this error ?

osimer pothe
  • 2,827
  • 14
  • 54
  • 92
  • This might be of help: https://github.com/basak/csipsimple/blob/master/pjsip_android/swig_tools/Makefile – SubOptimal Mar 23 '16 at 10:33
  • You need to compile the `libpjsua_jni.so` from source for your Android platform using the Android NDK. See also the [README.txt](https://github.com/basak/csipsimple/blob/master/pjsip_android/apps/pjsip/project/README.txt) or the [Getting Started: Building for Android](https://trac.pjsip.org/repos/wiki/Getting-Started/Android). – SubOptimal Mar 23 '16 at 11:01

0 Answers0