我在CSipSimple工作。当我尝试addBuddy时,执行以下代码。
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];
}
pjsua_buddy_config的构造函数调用以下代码:
public pjsua_buddy_config() {
this(pjsuaJNI.new_pjsua_buddy_config(), true);
}
那时我得到以下例外:
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)
我在互联网上搜索,发现此异常是由于加载.so文件的问题。我该如何解决这个错误?