user2028
user2028

Reputation: 183

Getting error while calling in webrtc android

I am getting crash while calling in webrtc android application.

Here is my error log :-

07-28 18:53:10.787: E/art(11672): JNI CallStaticBooleanMethodV called with pending exception 'java.lang.NoSuchMethodError' thrown in java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String):-2
07-28 18:53:10.815: A/art(11672): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: jmethodID was NULL
07-28 18:53:10.815: A/art(11672): art/runtime/check_jni.cc:65]     in call to CallStaticBooleanMethodV
07-28 18:53:10.816: A/art(11672): art/runtime/check_jni.cc:65]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)


07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   native: #12 pc 000778b9  /data/dalvik-cache/arm/system@[email protected] (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+152)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at java.lang.Runtime.nativeLoad(Native method)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at java.lang.Runtime.doLoad(Runtime.java:428)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   - locked <0x0dd4b515> (a java.lang.Runtime)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at java.lang.Runtime.loadLibrary(Runtime.java:369)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at java.lang.System.loadLibrary(System.java:989)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at org.webrtc.PeerConnectionFactory.<clinit>(PeerConnectionFactory.java:39)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at org.webrtc.PeerConnectionFactory.initializeAndroidGlobals(Native method)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionFactoryInternal(PeerConnectionClient.java:186)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at org.appspot.apprtc.PeerConnectionClient.access$12(PeerConnectionClient.java:180)
07-28 18:53:10.822: A/art(11672): art/runtime/check_jni.cc:65]   at org.appspot.apprtc.PeerConnectionClient$1.run(PeerConnectionClient.java:147)

Seems that it do not able to load libjingle_peerconnection_so ?

Any help will be appreciated. Thanks

Upvotes: 2

Views: 1152

Answers (1)

NixSam
NixSam

Reputation: 633

Follow instructions here: https://webrtc.org/native-code/android/

I'm not compiling debug version, I compile release like this:

gn gen out/Release --args='is_debug=false target_os="android" target_cpu="arm"'

+

ninja -C out/Release

Now you have release files. You need libjingle_peerconnection_so.so which you can find in out/Release folder (around 4.5MB) and you put that into armeabi-v7a folder.

You'll also need libwebrtc.jar which you can find in same folder. If you can't find it, build it with

ninja -C out/Release libwebrtc

Put libwebrtc.jar into libs folder.

Now, for releasing the app, you need to update proguard. This is what I have to put into proguard.cfg:

# webrtc
-dontwarn com.google.devtools.build.android.desugar.runtime.*
-keep class org.webrtc.** { *; }

This works for me, I hope it will work for you.

Upvotes: 2

Related Questions