编译WebRTC for Android

官方源码

官方WebRTC源码,地址:https://chromium.googlesource.com/external/webrtc.git

需要翻墙不稳定,建议购买美国的服务器

使用第三方脚本构建

//使用第三方构建脚本
# git clone https://github.com/pristineio/webrtc-build-scripts.git
# cd webrtc-build-scripts
# source android/build.sh
# install_dependencies  //安装需要的依赖工具(5分钟)
# get_webrtc  //下载webrtc源码(5个小时)
//编译得到release版本so库(很小)(7个小时)
# export WEBRTC_DEBUG=false
# build_apprtc

Release编译结果目录:

webrtc-build-scripts/android/webrtc/libjingle_peerconnection_builds/Release
  • so库:libjingle_peerconnection_so.so
  • jar包:base_java.jarlibjingle_peerconnection.jar

org.webrtc.voiceengine的jar包目录:

webrtc-build-scripts/android/webrtc/src/out_android_arm/Release/lib.java/webrtc/modules/audio_device

Android示例项目目录:

webrtc-build-scripts/android/webrtc/src/webrtc/examples/androidapp

若出现问题:

./install-build-deps-android.sh: line 25: ./install-build-deps.sh: No such file or directory

解决方法:

# curl https://chromium.googlesource.com/chromium/src/+/master/build/install-build-deps.sh?format=TEXT | base64 -d > install-build-deps.sh
# chmod u+x ./install-build-deps.sh

若出现问题:

Reading state information... Done
E: Unable to locate package openjdk-8-jre
E: Unable to locate package openjdk-8-jdk

Automatic java installation failed.
`java -version` reports:
java version "1.7.0_121"
OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.3)
OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)

`javac -version` reports:
./install-build-deps-android.sh: line 65: javac: command not found

Please ensure that JDK 8 is installed and resolves first in your PATH.
`which java` reports: /usr/bin/java
`which javac` reports: 
You might also try running:
    sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

解决方法:http://stackoverflow.com/questions/32942023/ubuntu-openjdk-8-unable-to-locate-package

# update-java-alternatives -l  //默认安装openjdk-7
# apt-get install python-software-properties software-properties-common  //安装依赖
# add-apt-repository ppa:openjdk-r/ppa  //添加源
# apt-get update
# apt-get install openjdk-8-jdk
# update-java-alternatives -l  //Java7和Java8共存
# sudo update-alternatives --config java  //配置使用Java7还是Java8
$ sudo mkdir /mnt/webrtc
$ sudo mount -t vboxsf webrtc /mnt/webrtc  //挂载共享文件夹
$ sudo umount -f /mnt/webrtc  //卸载共享文件夹

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/02/compiling-webrtc-for-android/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
编译WebRTC for Android
官方源码 官方WebRTC源码,地址:https://chromium.googlesource.com/external/webrtc.git 需要翻墙不稳定,建议购买美国的服务器 使用第三方脚本构建 //使……
<<上一篇
下一篇>>
文章目录
关闭
目 录