NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension


#1

I’ve been facing this crash and I have no idea why?

org.webrtc.Logging E MediaCodecVideoEncoder: initEncode failed
org.webrtc.Logging E MediaCodecVideoEncoder: android.media.MediaCodec$CodecException: Error 0xfffffc0e
System.err W java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
System.err W at org.webrtc.Logging.getStackTraceString(Logging.java:176)
System.err W at org.webrtc.Logging.e(Logging.java:156)
System.err W at org.webrtc.MediaCodecVideoEncoder.initEncode(MediaCodecVideoEncoder.java:531)
System.err W Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.google.devtools.build.android.desugar.runtime.ThrowableExtension” on path: DexPathList[[zip file “/system/framework/android.test.runner.jar”,
zip file “/data/app/com.atheer.airflow-2/base.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_dependencies_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_0_apk.apk”, zip file “/data
/app/com.atheer.airflow-2/split_lib_slice_1_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_2_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_3_apk.apk”, zip file “/data/ap
p/com.atheer.airflow-2/split_lib_slice_4_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_5_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_6_apk.apk”, zip file “/data/app/c
om.atheer.airflow-2/split_lib_slice_7_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_8_apk.apk”, zip file “/data/app/com.atheer.airflow-2/split_lib_slice_9_apk.apk”],nativeLibraryDirectories
=[/data/app/com.atheer.airflow-2/lib/arm, /data/app/com.atheer.airflow-2/base.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2
/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/com.a
theer.airflow-2/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_5_apk.apk!/lib/armeabi-v7a,
/data/app/com.atheer.airflow-2/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_8_apk.apk!/li
b/armeabi-v7a, /data/app/com.atheer.airflow-2/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
System.err W at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
System.err W at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
System.err W at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
System.err W … 3 more
rtc E #
rtc E # Fatal error in …/…/…/home/vagrant/webrtc/webrtc-checkout/src/sdk/android/src/jni/jni_helpers.cc, line 354
rtc E # last system error: 0
rtc E # Check failed: !jni->ExceptionCheck()
rtc E # error during DeleteGlobalRef
rtc E #
libc F Fatal signal 6 (SIGABRT), code -6 in tid 30379 (EncoderQueue - )
ACodec I [OMX.qcom.video.encoder.avc] Now Loaded
org.webrtc.Logging E MediaCodecVideoEncoder: initEncode failed
org.webrtc.Logging E MediaCodecVideoEncoder: android.media.MediaCodec$CodecException: Error 0xfffffc0e
DEBUG F #00 pc 00049ef8 /system/lib/libc.so (tgkill+12)
DEBUG F #01 pc 00047673 /system/lib/libc.so (pthread_kill+34)
DEBUG F #02 pc 0001d829 /system/lib/libc.so (raise+10)
DEBUG F #03 pc 00019321 /system/lib/libc.so (__libc_android_abort+34)
DEBUG F #04 pc 00017388 /system/lib/libc.so (abort+4)
DEBUG F #05 pc 00030cbb /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #06 pc 0002de05 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #07 pc 002e1ee3 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #08 pc 0031c209 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #09 pc 0031c233 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #10 pc 0031f91f /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #11 pc 0019c8b1 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #12 pc 0019c8bf /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #13 pc 0019d4c5 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #14 pc 0019ea5b /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #15 pc 001f81bf /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #16 pc 001f4721 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #17 pc 00200f9b /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #18 pc 001f27ed /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #19 pc 001f2f29 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #20 pc 001f4275 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #21 pc 0009b373 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #22 pc 0013bdab /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #23 pc 0009b1e7 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #24 pc 00032515 /data/app/com.atheer.airflow-2/lib/arm/libjingle_peerconnection_so.so
DEBUG F #25 pc 00047143 /system/lib/libc.so (_ZL15__pthread_startPv+22)
DEBUG F #26 pc 00019d99 /system/lib/libc.so (__start_thread+6)


#2

Oh, that was nasty! Unfortunately, the details elude me. I think it was related to Java 1.8 support in the Android app. I think we even patched WebRTC at some point for something related…

Did you build WebRTC yourself?

Do you have Java 1.8 support in your app? I guess you do because desugar is running but…


#3

Yeh I got it fixed by hacking it! Not pretty but works. Needed the introduce the flashligth toggling feature to webrtc so I used https://github.com/oney/react-native-webrtc build script to pull the webrtc code, add my code and rebuild it. What is weird is that the ThrowableExtension code does not exist in Logging.java of the provided pre-built libraries by oney. But when I rebuilt the library with their scripts I saw ThrowableExtension in the Logging.java file. As long as that is in the library things crash.

So my fix was build webrtc with my new code and take those compile java classes that I modified and inject them in the pre-built libwebrtc.jar file provided by oney. Dirty but works :slight_smile: