🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 下载 [github](https://github.com/open-webrtc-toolkit/owt-client-android) ``` git clone https://github.com/open-webrtc-toolkit/owt-client-android.git ``` ## 编译 使用google的webrtc库 ``` implementation 'org.webrtc:google-webrtc:1.0.30039' implementation files('org.webrtc') ``` 编译android webrtc代码,android的webrtc代码只能在linux上编译,mac上需要修改代码。 gradle下载慢的解决方法:[https://blog.csdn.net/jgw2008/article/details/96155000](https://blog.csdn.net/jgw2008/article/details/96155000) 找到工程项目的build.gradle,**注释掉 jcenter()** ,改用国内**阿里云的maven库**地址 这里注意,只需要分别修改 buildscript 和 allprojects 的 repositories 即可 ``` // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven { url "https://jitpack.io" } google() // jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } } allprojects { repositories { // jcenter() maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'} google() } } task clean(type: Delete) { delete rootProject.buildDir } ``` To build the entire project including sdk and samples ``` ./gradlew assembleRelease ``` To build the specific module, e.g. base ``` ./gradlew assembleRelease -p src/sdk/base ``` 打包 ``` python tools/pack.py ``` ## idea上的配置 file->project structure,添加SDK和JDK,首先设置JDK,这里选择我们添加到环境变量的JDK,然后添加SDK把所有下载的SDK都添加到设置里。 ![aM3zef.png](https://s1.ax1x.com/2020/07/30/aM3zef.png) ![aM8Sw8.png](https://s1.ax1x.com/2020/07/30/aM8Sw8.png) ## 在mac上的错误 参考链接:[https://www.twle.cn/t/566](https://www.twle.cn/t/566) 解决 Failed to install the following Android SDK packages as some licences have not been accepted 很简单,在命令行里输入 ``` sdkmanager --licenses ``` 然后就有一大堆的 license 等着你输入`yes` 如果不想每次都输入`yes`那么只需要运行下面的命令 ``` yes | sdkmanager --licenses ```