Compile android and linux version webrtc under ubuntu 16.04

1. Prepare the ubuntu 16.04 x86_64 environment, mine is installed in the virtual machine;

2. Install tools such as git and Python2.7, either source code or apt-get command

3. Download depot_tools (https://storage.googleapis.com/chrome-infra/depot_tools.zip), if the download fails, you can go to the network disk to download the link: https://pan.baidu.com/s/1McwHI2Xxf5XJFgbpMSnoTA  extraction code :o0fr 

Add its path to ~/.bashrc after decompression, (export PATH=/home/xxx/webrtc/depot_tools:"$PATH"),

This step is very important, the downloaded and compiled tools are in depot_tools.

3. Download and update the source code
mkdir webrtc_checkout
cd webrtc_checkout
fetch --nohooks webrtc_android (do not make mistakes in this step, otherwise even if the next step succeeds, many things will be missing)
gclient sync

4. Use the built-in script to download and install the dependent library
cd src
build/install-build-deps.sh 
build/install-build-deps-android.sh

5. Generate build script
gn gen out/Debug --args='target_os="android" target_cpu="arm"' (android version)
gn gen out/LinuxDebug (Linux version)

6. Compile
ninja -C out/Debug
ninja -C out/LinuxDebug

7. The compiled
apk is located in out/Debug/apks/AppRTCMobile.apk, and there are many apks for testing under out/Debug.
Linux executable files are located under out/LinuxDebug, such as peerconnection_server, peerconnection_client, etc.


8. Generate gradle build/android/gradle/generate_gradle.py for Android Studio --output-directory $PWD/out/Debug \
--target "//examples:AppRTCMobile" --use-gradle-process-resources \
--split-projects --canary
results under out/Debug/gradle

Reference: https://www.cnblogs.com/swordc007/p/10604838.html

Guess you like

Origin blog.csdn.net/zhuquanfu/article/details/90235951