1. Installing depot Tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
Then add the depot_tools to the environment variable.
Export Path=path_to_depot_tools: $PATH
2. Download the Code
Create a working directory
mkdir WEBRTCCD WebRTC
Download code
Export gyp_defines="os=android"--sync
This would fetch a regular WebRTC checkout with the android-specific parts added. Notice that the Android specific parts like the Android SDK and NDK is quite large (to GB), so the total checkout size WI ll be is about + GB. The same checkout can be used to both Linux and Android development since you can generate your Ninja project files in di Fferent directories for each build config.
3. Compiling the Code
Creating a project with GN
Under the SRC directory, execute the following command
GN Gen Out/debug--args='target_os= "android" target_cpu= "arm"
You can specify a directory of your own choice instead out/Debug of, to enable managing multiple configurations in parallel.
- To build for Arm64:use
target_cpu="arm64"
- To build for 32-bit X86:use
target_cpu="x86"
- To build for 64-bit X64:use
target_cpu="x64"
Then compile the code with Ninja
Ninja-c Out/debug
Once the compilation is complete, you can find apprtcmobile.apk in the Out/debug/apks directory.
Android WebRTC Code Download compilation