无法编译适用于Android的WebRTC库 [英] Unable to Compile WebRTC Library for Android

查看:620
本文介绍了无法编译适用于Android的WebRTC库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译WebRTC本机堆栈以构建libwebrtc.aar,但不幸的是无法理解问题所在.

I am trying to compile WebRTC Native Stack to build libwebrtc.aar but unfortunately unable to understand what's going wrong.

系统信息:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic
Java-Version:   OpenJDK-8-JDK
Python-Version: Python 2.7.17


我已按照官方WebRTC本机开发中提供的完整步骤进行操作Android .这些步骤已经完成,没有任何 interrupt 中断,并且每个步骤都花了一些时间才能完成.然后,我必须安装构建源代码所需的所有依赖项.


I have followed the complete steps provided in the official WebRTC Native Development for Android. These steps have been completed without any interruption and every step took its time for completion. Then, I have to install all the dependency needed to build the source code.

./build/install-build-deps.sh

在编译代码之前,我还检出了特定的git分支以使用不同的WebRTC版本,以使用此git命令列出所有分支.

Before compiling the code I have also checked-out to particular git branch to go into different available WebRTC versions, to list all the branches using this git command.

git branch -r

我正在分享最新的Git分支机构:

I am sharing the latest Git Branches:

我尝试了从branch-heads/60branch-heads/m79的每个git分支,并且在使用编译命令时每个分支都有不同的问题.我尝试了这两个过程来构建库,例如:

I have tried every git branch from branch-heads/60 to branch-heads/m79, and every branch has a different issue while using the compiling commands. I have tried these two procedures to build the library such as:

1-使用AAR生成工具(./tools_webrtc/android/build_aar.py)

1- Using AAR Build Tools (./tools_webrtc/android/build_aar.py)

confu@ubuntu:~/webrtc_android/src$ tools_webrtc/android/build_aar.py
INFO:root:Building: armeabi-v7a
ERROR at //webrtc.gni:591:7: Can't load input file.
      absl_include_config,
      ^------------------
Unable to load:
  /home/confu/webrtc_android/src/third_party/abseil-cpp/BUILD.gn
I also checked in the secondary tree for:
  /home/confu/webrtc_android/src/build/secondary/third_party/abseil-cpp/BUILD.gn
Traceback (most recent call last):
  File "tools_webrtc/android/build_aar.py", line 234, in <module>
    sys.exit(main())
  File "tools_webrtc/android/build_aar.py", line 230, in main
    args.build_dir, args.extra_gn_switches, args.extra_ninja_switches)
  File "tools_webrtc/android/build_aar.py", line 210, in BuildAar
    extra_ninja_switches)
  File "tools_webrtc/android/build_aar.py", line 166, in Build
    _RunGN(gn_args_list)
  File "tools_webrtc/android/build_aar.py", line 93, in _RunGN
    subprocess.check_call(cmd)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', '/home/confu/webrtc_android/src/third_party/depot_tools/gn.py', 'gen', '/tmp/tmp1JDmHL/armeabi-v7a', '--args=arm_version=7 use_goma=false target_cpu="arm" is_component_build=false is_debug=false rtc_include_tests=false target_os="android"']' returned non-zero exit status 1


2-使用手动编译(gn gen out/Debug --args='target_os="android" target_cpu="arm"')

confu@ubuntu:~/webrtc_android/src$ gn gen out/Debug --args='target_os="android" target_cpu="arm64"'
ERROR at //BUILD.gn:648:20: Assignment had no effect.
      java_files = [
                   ^
You set the variable "java_files" here and it was unused before it went
out of scope.
See //BUILD.gn:647:5: whence it was called.
    junit_binary("android_junit_tests") {
    ^------------------------------------


推荐答案

Usman,按照我的步骤进行操作,就可以生成有效的webrtc aar模块:

Usman, Follow i followed these steps and i was able to generate a valid webrtc aar module:

 git checkout origin/master
 gclient revert
 gclient sync

然后您将解决您的问题.您正在签出起源后的分支,那里没有构建libwebrtc.aar

And you will have your issues sorted. You are checking out a branch which is behind the origin and doesn't have all dependencies and modules over there required to build your libwebrtc.aar

这篇关于无法编译适用于Android的WebRTC库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆