0

I am using PJSIP in my android project and it is working great. Now, I need to add Opus-Android lib in my project. The code compile pretty well but the problem occurs when the Application is launched. It give me following exception:

ava.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.matsoltech.android.chatellite-1/base.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.matsoltech.android.chatellite-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.matsoltech.android.chatellite-1/lib/arm64, /data/app/com.matsoltech.android.chatellite-1/base.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.matsoltech.android.chatellite-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libpjsua2.so"
                                                                         at java.lang.Runtime.loadLibrary0(Runtime.java:984)
                                                                         at java.lang.System.loadLibrary(System.java:1530)
                                                                         at com.matsoltech.android.chatellite.utils.pjsua_utils.MyApp.<clinit>(MyApp.java:51)
                                                                         at com.matsoltech.android.chatellite.utils.service.MainService.setupPJSUA(MainService.java:99)
                                                                         at com.matsoltech.android.chatellite.utils.service.MainService.onStartCommand(MainService.java:90)
                                                                         at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326)
                                                                         at android.app.ActivityThread.-wrap21(ActivityThread.java)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:154)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

As soon as I remove the Opus from gradle, the pjsip lib start working normally.

Here are my dependencies:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'ch.acra:acra:4.9.0'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'top.oply.opuslib:opuslib:1.0.2'
testCompile 'junit:junit:4.12'
}

the gradle for my app:

compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.matsoltech.android.chatellite"
        minSdkVersion 11
        targetSdkVersion 25
        versionCode 1
        versionName code.toString()
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {
            moduleName "libpjsua2"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            jniDebuggable true
        }

    }

And the exception thrown is here:

static {

    System.loadLibrary("pjsua2");
    System.out.println("Library loaded");
}

So, where am I doing wrong?

awaistoor
  • 786
  • 2
  • 11
  • 36

1 Answers1

0

You need this then your code should be work.

Project Compilation

pre-requisites

JDK v1.8 or higher
SDK v2.2.1 or higher
NDK r10d or higher (Note: remember to export NDK's path)
Android Studio (with SDK) 1.2.1 or higher
Community
  • 1
  • 1
Attaullah
  • 3,856
  • 3
  • 48
  • 63