Android webrtc java version issue

674 views
Skip to first unread message

Sergey Alekseev

unread,
Dec 20, 2023, 8:52:31 AM12/20/23
to discuss-webrtc
Hey guys,

I'm developing the android application based on Xamarin.Forms that uses the webrtc libs.

I want to update webrtc libraries (currently I'm using m108 release version).
I don't have any issues with webrtc building (I'm using the depoot_tools to get repo and the python script from repo for building -  ./tools_webrtc/android/build_aar.py). I'm building it by the Azure pipeline using Ubuntu20-04 with Java 11 by default.

Looks like the build of the m120 release uses java 17 - I see in some files the major version is 61 that's mapping to the java 17. For example, org/webrtc/RTCStatsCollectorCallback.class.

As result, I have the issues when I'm trying to use it in the Xamarin.Forms project (because currently Xamarin.Forms is limited to API 33 (Android 13, Java 11).

Example of the error:

## Error JAVAC0000:  error: cannot access RTCStatsCollectorCallback

    org.webrtc.RTCStatsCollectorCallback

  bad class file: obj\Debug\130\lp\15\jl\bin\classes.jar(/org/webrtc/RTCStatsCollectorCallback.class)

    class file has wrong version 61.0, should be 55.0

    Please remove or make sure it appears in the correct subdirectory of the classpath.


Could you please help with clarification of this issue and advice how I can resolve this? I cannot use java 17 in my project, but I need to update webrtc libraries. 


Thank you for any help!

Sergey Alekseev

unread,
Apr 2, 2024, 8:58:09 AM4/2/24
to discuss-webrtc
Just FYI,

I fixed this issue with removing the jdk dependency from script.
it can be done very easy using gclient config specification

gclient config --spec 'solutions = [
{
    "name": "src",
    "url": "https://webrtc.googlesource.com/src.git",
    "deps_file": "DEPS",
    "managed": False,
    "custom_deps": {
        "src/third_party/jdk": None
    },
},
]
target_os = ["android", "unix"]
'

In this case, it will not use the dependency from chromium repo, but will use jdk you have installed on the machine where this script is performing.
I just limited jdk to 11 before build libraries.

It works like short time solution for now, but potentially it will be better just migrate Xamarin.Froms solution to MAUI with using latest Android version (with latest jdk)

Hope it will help you

среда, 20 декабря 2023 г. в 16:52:31 UTC+3, Sergey Alekseev:
Reply all
Reply to author
Forward
0 new messages