UnsatisfiedLinkError in pjsip library

2019-03-04 11:48发布

问题:

I build Pjsip library and use its sample in android studio .

question

When I run that i got this error.How could I solve it ? thanks in advance.

exception

jsip.pjsua2.app E/AndroidRuntime: FATAL EXCEPTION: main Process: org.pjsip.pjsua2.app, PID: 4360 java.lang.UnsatisfiedLinkError: No implementation found for void org.pjsip.pjsua2.pjsua2JNI.swig_module_init() (tried Java_org_pjsip_pjsua2_pjsua2JNI_swig_1module_1init and Java_org_pjsip_pjsua2_pjsua2JNI_swig_1module_1init__) at org.pjsip.pjsua2.pjsua2JNI.swig_module_init(Native Method) at org.pjsip.pjsua2.pjsua2JNI.(pjsua2JNI.java:2351) at org.pjsip.pjsua2.Endpoint.(Endpoint.java:68) at org.pjsip.pjsua2.app.MyApp.(MyApp.java:296) at org.pjsip.pjsua2.app.MainActivity.onCreate(MainActivity.java:92) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2442) at android.app.ActivityThread.access$800(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5389) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

回答1:

It may happens for several reason.First check if you attached the native library correctly.For that create a folder named "jniLibs" into the projects

app/src/main/jniLibs

then put your armeabi architecture library like

armeabi/libpjsua2.so

for other architecture like armeabi-v7a use

armeabi-v7a/libpjsua2.so

like this.

there are other reason may happen.If you build pjsip library for armeabi architecture only and and running your application in a x86 architecture device then this error may occur.So check it also if you have build it for that application.



回答2:

Please take a look at this thread: building pjsua2 dll

the important thing to know here is that the error you show in your question is caused by the fact that the pjsua2.dll (a c++ dll) is not in your output directory.