WebRTC: Compile Native WebRTC Android SDK
The very first step of modifying native WebRTC SDK for Android is cloning source code from WebRTC repository and compiling it into jar.
Install depot_tools
depot_tools is a set of version control/build tools. We can get it from chromium repository:
1 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
Then export those tools into PATH
:
1 | export PATH=$PATH:/${depot_tools_path} |
Fetch code
1 | cd ${path_you_want_to_save_webrtc_code} |
Checkout to your base branch
I was using m79
:
1 | cd webrtc_android/src/ |
Install build dependencies and compile
1 | cd webrtc_android/src/ |
build_aar.py will compile code, and package native and jar libraries into webrtc_android/src/libwebrtc.aar
Use the built libwebrtc.aar in your Android Studio app project
- Copy aar files to
${your_android_studio_app_project}/libs/
- If you have
implementation 'org.webrtc:google-webrtc:xxxxxxxxxx'
inbuild.gradle
, remove it.