引起:java.lang.UnsatisfiedLinkError:找不到库pjsua2

时间:2014-04-05 08:06:54

标签: java android java-native-interface sip pjsip

我正在使用pjsua2 lib进行voip调用,在构建示例应用程序之后,在lib-> armebie文件夹中创建了一个名为pjsua2.so的文件。现在这个示例应用程序在4.1.1版本中运行良好,但同样的应用程序在版本2.2中崩溃并提供异常

04-05 13:27:11.936: W/dalvikvm(8936): VFY: unable to resolve virtual method 81: Ljava/lang/String;.isEmpty ()Z
04-05 13:27:12.236: W/dalvikvm(8936): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lorg/pjsip/pjsua2/app/MyApp;.<clinit>
04-05 13:27:12.236: W/dalvikvm(8936): threadid=1: thread exiting with uncaught exception (group=0x400207d8)
04-05 13:27:12.256: E/AndroidRuntime(8936): FATAL EXCEPTION: main
04-05 13:27:12.256: E/AndroidRuntime(8936): java.lang.ExceptionInInitializerError
04-05 13:27:12.256: E/AndroidRuntime(8936):     at org.pjsip.pjsua2.app.MainActivity.onCreate(MainActivity.java:93)
04-05 13:27:12.256: E/AndroidRuntime(8936):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 13:27:12.256: E/AndroidRuntime(8936):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2633)
04-05 13:27:12.256: E/AndroidRuntime(8936):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2685)
04-05 13:27:12.256: E/AndroidRuntime(8936):     at android.app.ActivityThread.access$2300(ActivityThread.java:126)
04-05 13:27:12.256: E/AndroidRuntime(8936):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)

任何人都可以告诉我这个问题吗?

这是make文件

include ../../../../../build.mak

LOCAL_PATH  := $(PJDIR)/pjsip-apps/src/swig/java/android
include $(CLEAR_VARS)

LOCAL_MODULE    := libpjsua2
LOCAL_CFLAGS    := $(APP_CFLAGS) -frtti -fexceptions
LOCAL_LDFLAGS   := $(APP_LDFLAGS)
LOCAL_LDLIBS    := $(APP_LDLIBS)
LOCAL_SRC_FILES := ../output/pjsua2_wrap.cpp

include $(BUILD_SHARED_LIBRARY)

2 个答案:

答案 0 :(得分:0)

您的问题与pjsua2库的路径有关。检查加载库的源。尝试将此静态块添加为静态:

static {
System.load("path to your library";
System.out.println("library loaded");
}

答案 1 :(得分:0)

当你开始构建PJSUA2时,不要忘记为你将要使用的每个armeabi构建它。例如:TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags