WebRTC-M68-官方编译文档-Android'

The easiest way to get started is using the official prebuilt libraries available at JCenter. These libraries are compiled from the tip-of-tree and are meant for development purposes only.

On Android Studio 3 add to your dependencies: 
implementation 'org.webrtc:google-webrtc:1.0.+' 
On Android Studio 2 add to your dependencies: 
compile 'org.webrtc:google-webrtc:1.0.+' 
The version of the library is 1.0.. The hash of the commit can be found in the .pom-file. The third party licenses can be found in the THIRD_PARTY_LICENSES.md file next to the .aar-file.

Getting the Code

Install prerequisite software 先安装工具 depot_tools等

fetch –nohooks webrtc_android 
gclient sync

This will fetch a regular WebRTC checkout with the Android-specific parts added. Notice that the Android specific parts like the Android SDK and NDK are quite large (~8 GB), so the total checkout size will be about 16 GB. The same checkout can be used for both Linux and Android development since you can generate your Ninja project files in different directories for each build config.

See Development for instructions on how to update the code, building etc.

Compiling 
Generate projects using GN.

Make sure your current working directory is src/ of your workspace. Then run:

gn gen out/Debug –args=’target_os=”android” target_cpu=”arm”’

You can specify a directory of your own choice instead of out/Debug, 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"
 
Compile using:

ninja -C out/Debug

Using the Bundled Android SDK/NDK 
In order to use the Android SDK and NDK that is bundled in third_party/android_tools, run this to get it included in your PATH (from src/):

. build/android/envsetup.sh 
Then you’ll have adb and all the other Android tools in your PATH.

Running the AppRTCMobile App 
AppRTCMobile is an Android application using WebRTC Native APIs via JNI (JNI wrapper is documented here).

For instructions on how to build and run, see examples/androidapp/README.

Using Android Studio 
Build the project normally (out/Debug should be the directory you used when generating the build files using GN):

ninja -C out/Debug AppRTCMobile

Generate the project files:

build/android/gradle/generate_gradle.py –output-directory $PWD/out/Debug \ 
–target “//examples:AppRTCMobile” –use-gradle-process-resources \ 
–split-projects –canary

Import the project in Android Studio. (Do not just open it.) The project is located in out/Debug/gradle. If asked which SDK to use, choose to use Android Studio’s SDK. When asked whether to use the Gradle wrapper, press “OK”.

以上为官方步骤,推荐VPS网站Vultr,具体方法可以见使用教程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值