2

I succesfully compiled PJSIP library for Android. Sample project works without any problems when I build for default architecture armeabi. Now I tried to compile library for arch such as armeabi-v7a and arm64-v8a. Unfortunately when I add libraries to project in appropriate folders (jnLibs/armeabi-v7a and jniLibs/arm64-v8a) application is not starting...

To setup build for different archs I use this command:

NDK_TOOLCHAIN_VERSION=4.9 TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags

I have this error on app launch:

07-04 12:28:46.079 15317-15317/? E/AndroidRuntime: FATAL EXCEPTION: main
                                               Process: com.futuremind.omili, PID: 15317
                                               java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "getifaddrs" referenced by "/data/app/com.futuremind.omili-1/lib/arm/libpjsua2.so"...
                                                   at java.lang.Runtime.loadLibrary(Runtime.java:372)
                                                   at java.lang.System.loadLibrary(System.java:1076)
                                                   at com.futuremind.omili.MyApp.<clinit>(MyApp.java:293)
                                                   at com.futuremind.omili.MainActivity.onCreate(MainActivity.java:87)
                                                   at android.app.Activity.performCreate(Activity.java:6289)
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535)
                                                   at android.app.ActivityThread.access$900(ActivityThread.java:155)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:152)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5497)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Thanks for any help! :)

Zygi
  • 754
  • 8
  • 17
  • have you found any solution for this error? – mark Jul 28 '17 at 08:13
  • Nope... I didn't found any solution. Beacause I'm not using video I don't need so much performance. I'm just using standard armeabi but it would be nice to target higher ABIs. – Zygi Jul 28 '17 at 10:42
  • Very strange. I have built pjsip with same commands, export NDK_TOOLCHAIN_VERSION=4.9 and then TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags. Perhaps you initiate your library somehow wrong in java code. Can you post your endpoint creation? P.S. You should know as well that jniLibs folder have to be located in the main folder together with java and res folders. –  Jul 28 '17 at 10:59
  • jniLibs folder is located correctly. I use sample project so library is intiated as it is in sample project. Same thing with the endpoint. It's initiated in the same way as it is in sample. It works with armeabi but not with other architectures. – Zygi Jul 28 '17 at 14:01

1 Answers1

1

I was able to fix this error by updating the AndroidManifest.xml in "pjsip-apps/src/swig/java/android/app/src/main" to match my android target -- in my case to "23". Then "make clean" and another "make" in "pjsip-apps/src/swig", and rebuilding my app.