在《WebRTC之Android编译》
一文中我们已经成功编译了Android版WebRTC,并且通过分析对比拿到了对应的jar包和so库。
在WebRTC的src/example
目录下有很多的关于WebRTC的demo,那么如何将这些demo导入到Android Studio中进行分析呢?本文来为你揭晓…
同样我们参照官方的教程试下:https://webrtc.github.io/webrtc-org/native-code/android/
注意,以下命令都是在WebRTC源码目录的src
目录下执行
编译AppRTCMobile
1、编译
# 配置输出目录和cpu架构 将产物输出到out/StudioDebug目录
gn gen out/StudioDebug --args='target_os="android" target_cpu="arm"'
# 编译
ninja -C out/StudioDebug AppRTCMobile
2、生成Android Studio工程所需的gradle文件
# 注意这是一条命令,不是三条
build/android/gradle/generate_gradle.py --output-directory $PWD/out/StudioDebug \
--target "//examples:AppRTCMobile" --use-gradle-process-resources \
--split-projects --canary