Discord app targets API level 16, which does not support Java 8. Fortunately, with desugaring, we can still support API level 16, please see https://developer.android.com/studio/write/java8-support.html - however, external libraries already need to be desugared.
Java 8 is needed for building WebRTC 65. Instead of a single libwebrtc.jar
, the following files are generated (javap -verbose MyClass | grep "major"
):
Name | Version | Notes |
---|---|---|
libwebrtc.jar |
52 | ThreadUtils and Logging classes |
audio_device_java.interface.java |
52 | |
audio_device_java.jar |
51 | |
libjingle_peerconnection_java.interface.jar |
52 | |
libjinlge_peerconnection_java.jar |
51 | |
libjingle_peerconnection_metrics_default_java.interface.jar |
52 | Not used |
libjingle_peerconnection_metrics_default_java.jar |
51 | Not used |
Interface JARs are merely function declarations and have major version 52 (Java 8), while implementation JARs are desugared to version 51 (Java 7).
When building WebRTC for Android, we reverted back to using dist_jar
template, without interface JAR and with desugaring. This generated a single Java 7 libwebrtc.jar
(just as with WebRTC 59). However EglBase::create
(static interface method) is unavailable in libwebrtc.jar
. We added a simple helper class as workaround.
The patch below is applied to WebRTC m65 branch 7ee493622bb721cc14bf45edf22a69118402f971.