0

I'm trying to add PJSIP to an android project and make a test run.
I followed the official documentation of PSIP

I'm getting the following error when running the project

E/art: 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__)
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.tizinmobile.test_pjsip, PID: 3323
                  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.<clinit>(pjsua2JNI.java:2628)
                      at org.pjsip.pjsua2.pjsua2JNI.new_Endpoint(Native Method)
                      at org.pjsip.pjsua2.Endpoint.<init>(Endpoint.java:0)
                      at com.tizinmobile.test_pjsip.MainActivity.onCreate(MainActivity.java:14)
                      at android.app.Activity.performCreate(Activity.java:6876)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                      at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:158)
                      at android.app.ActivityThread.main(ActivityThread.java:7224)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

What I tried:

  1. Builded PJSIP for multiple ABI targets
  2. Ran swig to create the android example project with .so files
  3. Copied these files to app/lib
  4. Settings in Gradle to include the .so files

Gradle settings:

android {
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }        
}

Project structure

── libs
│   ├── arm64-v8a
│   ├── armeabi
│   ├── armeabi-v7a
│   ├── mips64
│   ├── x86
│   └── x86_64
└── src
    ├── androidTest
    │   └── java
    ├── main
    │   ├── java
    │   └── res
    └── test
        └── java
Jouke
  • 459
  • 1
  • 7
  • 20

1 Answers1

-1

In my code adding this fixed the error:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        System.loadLibrary("pjsua2");
        System.out.println("Library loaded");
    }
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
LRA
  • 1
  • 3