java.lang.UnsatisfiedLinkError:找不到本机方法:org.webrtc.PeerConnectionFactory.initializeFieldTrials:(Ljava / lang / String;)V

时间:2015-04-06 12:23:18

标签: android java-native-interface webrtc videochat peer-connection

我正在开发一个具有视频聊天功能的模块。为此,我正在使用Webrtc。我非常接近这样做但我在打电话时遇到了一个问题。

服务器始终返回

{"params": {"messages": []}, "result": "FULL"}

之后我又得到了另外一个问题,

java.lang.UnsatisfiedLinkError: Native method not found: org.webrtc.PeerConnectionFactory.initializeFieldTrials:(Ljava/lang/String;)V

首先我遇到了jingle原生库的问题。我也把它集成在jni目录中。还更新了peerconnection_jni.cc文件,但错误相同..

我也可以附加peerconnection_jni.cc文件(如果需要)。

我也在谷歌上搜索过。但没有得到实际的输出。有人可以帮帮我吗?

更新:

这是我的peerconnection_jni.cc的代码

extern "C" {
    JNIEXPORT void JNICALL Java_org_webrtc_PeerConnectionFactory_initializeFieldTrials
    (JNIEnv* evn,jclass _class,jstring j_trials_init_string) {
        field_trials_init_string = NULL;
        if (j_trials_init_string != NULL) {
            const char* init_string =
                    jni->GetStringUTFChars(j_trials_init_string, NULL);
            int init_string_length = jni->GetStringUTFLength(j_trials_init_string);
            field_trials_init_string = new char[init_string_length + 1];
            rtc::strcpyn(field_trials_init_string, init_string_length + 1, init_string);
            jni->ReleaseStringUTFChars(j_trials_init_string, init_string);
            LOG(LS_INFO) << "initializeFieldTrials: " << field_trials_init_string;
        }
        webrtc::field_trial::InitFieldTrialsFromString(field_trials_init_string);
    }
}

这是我的Logcat输出。

04-06 19:20:57.041: E/AppRTCDemoActivity(26645): Fatal error: Native method not found: org.webrtc.PeerConnectionFactory.initializeFieldTrials:(Ljava/lang/String;)V
04-06 19:20:57.041: E/AppRTCDemoActivity(26645): java.lang.UnsatisfiedLinkError: Native method not found: org.webrtc.PeerConnectionFactory.initializeFieldTrials:(Ljava/lang/String;)V
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at org.webrtc.PeerConnectionFactory.initializeFieldTrials(Native Method)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionFactoryInternal(PeerConnectionClient.java:268)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at org.appspot.apprtc.PeerConnectionClient.access$18(PeerConnectionClient.java:257)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at org.appspot.apprtc.PeerConnectionClient$1.run(PeerConnectionClient.java:222)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at android.os.Handler.handleCallback(Handler.java:725)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at android.os.Handler.dispatchMessage(Handler.java:92)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at android.os.Looper.loop(Looper.java:137)
04-06 19:20:57.041: E/AppRTCDemoActivity(26645):    at org.appspot.apprtc.util.LooperExecutor.run(LooperExecutor.java:57)

0 个答案:

没有答案