PJSUA2 sip android native app

2019-01-26 18:55发布

问题:

Here I'm developing an application using native android in ubuntu 14.04LTS eclipse adt for android.

Build, configure, and make everything went perfect.

After that I imported pjsua2 sample app into eclipse, I then added native library support but when I run on emulator it throws an error.

The error log,

10-25 06:12:09.489: E/AndroidRuntime(1571): FATAL EXCEPTION: main 10-25 06:12:09.489: E/AndroidRuntime(1571): Process: org.pjsip.pjsua2.app, PID: 1571 10-25 06:12:09.489: E/AndroidRuntime(1571): java.lang.UnsatisfiedLinkError: Couldn't load libpjsua2.so from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.pjsip.pjsua2.app-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.pjsip.pjsua2.app-2, /vendor/lib, /system/lib]]]: findLibrary returned null 10-25 06:12:09.489: E/AndroidRuntime(1571): at java.lang.Runtime.loadLibrary(Runtime.java:358) 10-25 06:12:09.489: E/AndroidRuntime(1571): at java.lang.System.loadLibrary(System.java:526) 10-25 06:12:09.489: E/AndroidRuntime(1571): at org.pjsip.pjsua2.app.MyApp.(MyApp.java:235) 10-25 06:12:09.489: E/AndroidRuntime(1571): at org.pjsip.pjsua2.app.MainActivity.onCreate(MainActivity.java:85) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.Activity.performCreate(Activity.java:5231) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.ActivityThread.access$800(ActivityThread.java:135) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.os.Handler.dispatchMessage(Handler.java:102) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.os.Looper.loop(Looper.java:136) 10-25 06:12:09.489: E/AndroidRuntime(1571): at android.app.ActivityThread.main(ActivityThread.java:5017) 10-25 06:12:09.489: E/AndroidRuntime(1571): at java.lang.reflect.Method.invokeNative(Native Method) 10-25 06:12:09.489: E/AndroidRuntime(1571): at java.lang.reflect.Method.invoke(Method.java:515) 10-25 06:12:09.489: E/AndroidRuntime(1571): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 10-25 06:12:09.489: E/AndroidRuntime(1571): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 10-25 06:12:09.489: E/AndroidRuntime(1571): at dalvik.system.NativeStart.main(Native Method) 10-25 06:12:09.499: W/ActivityManager(403): Force finishing activity org.pjsip.pjsua2.app/.MainActivity 10-25 06:12:09.809: I/WindowManager(403): Screenshot max retries 4 of Token{b4148710 ActivityRecord{b41c4ef8 u0 org.pjsip.pjsua2.app/.MainActivity t2 f}} appWin=Window{b4086b40 u0 Starting org.pjsip.pjsua2.app} drawState=4 10-25 06:12:09.809: W/WindowManager(403): Screenshot failure taking screenshot for (480x800) to layer 21010 10-25 06:12:10.009: D/dalvikvm(403): GC_FOR_ALLOC freed 91K, 14% free 7331K/8436K, paused 72ms, total 74ms 10-25 06:12:10.359: W/ActivityManager(403): Activity pause timeout for ActivityRecord{b41c4ef8 u0 org.pjsip.pjsua2.app/.MainActivity t2 f} 10-25 06:12:10.719: I/Choreographer(403): Skipped 94 frames! The application may be doing too much work on its main thread. 10-25 06:12:10.869: I/Choreographer(581): Skipped 35 frames! The application may be doing too much work on its main thread. 10-25 06:12:11.599: I/Process(1571): Sending signal. PID: 1571 SIG: 9 10-25 06:12:11.609: E/SoundPool(403): error loading /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.609: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.659: I/ActivityManager(403): Process org.pjsip.pjsua2.app (pid 1571) has died. 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/KeypressStandard.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/KeypressSpacebar.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/KeypressDelete.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/KeypressReturn.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg 10-25 06:12:11.669: E/SoundPool(403): error loading /system/media/audio/ui/KeypressInvalid.ogg 10-25 06:12:11.669: W/AudioService(403): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg 10-25 06:12:11.669: W/AudioService(403): onLoadSoundEffects(), Error -1 while loading samples 10-25 06:12:12.259: I/Choreographer(403): Skipped 171 frames! The application may be doing too much work on its main thread. 10-25 06:12:12.609: W/InputMethodManagerService(403): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b410f460 attribute=null, token = android.os.BinderProxy@b405a130

回答1:

java.lang.UnsatisfiedLinkError: Couldn't load libpjsua2.so from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.pjsip.pjsua2.app-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.pjsip.pjsua2.app-2, /vendor/lib, /system/lib]]]: findLibrary returned null

I had the same error. The android sample app tries to load this libpjsua2.so from the JNILIBs folder path but it couldnt find it so it throws the above error.Hope my answer helps someone .



回答2:

I had the same problem. It seems you was building pjsip library using newest ndk. Try older version of ndk and rebuild pjsip.



回答3:

I followed this https://github.com/VoiSmart/pjsip-android-builder link to build the pjsip hope it would help others but still facing some problems in video calling related.