Webrtc android的编译步骤

这篇具有很好参考价值的文章主要介绍了Webrtc android的编译步骤。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

首先下载depot_tools

按官方教程来

https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up

$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=/path/to/depot_tools:$PATH设置depot 的环境变量然后走 fetch webrtc_android的脚本 看官方链接https://webrtc.googlesource.com/src/+/main/docs/native-code/android/
$ fetch --nohooks webrtc_android
$ gclient sync

这步骤操作完后会产生这两个目录

.gclient   # A configuration file for you source checkout
src/       # Top-level Chromium source checkout.

Compiling

首先运行下一些相关依赖

./build/install-build-deps.sh --android
  1. 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="arm64"'

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"
  1. Compile using:
$ autoninja -C out/Debug

弄完后生成能导入android studio的gradle依赖 用官方推荐的有个坑加上--canary会出错 去掉了这个参数

./build/android/gradle/generate_gradle.py --output-directory $PWD/out/Debug --target "//examples:AppRTCMobile" --use-gradle-process-resources --split-projects 

然后编一个debug版的包

首先在

./build/toolchain/android/BUILD.gn 里注释这几行

...
template("android_clang_toolchain") {
  ...
  _prefix = rebase_path("$clang_base_path/bin", root_build_dir)
  cc = "$_prefix/clang"
  cxx = "$_prefix/clang++"
  ar = "$_prefix/llvm-ar"
  ld = cxx
  readelf = _tool_prefix + "readelf"
  nm = _tool_prefix + "nm"
  # 注释掉下面两行配置,即可实现 unstrip
  # strip = rebase_path("//buildtools/third_party/eu-strip/bin/eu-strip",
  #                     root_build_dir)
  # use_unstripped_as_runtime_outputs = android_unstripped_runtime_outputs
  ...
}
...

然后编译脚本加两个参数

gn gen out/Debug --args='target_os="android" target_cpu="arm64" is_debug=true symbol_level=2 android_full_debug=true'
然后 autoninja -C out/Debug

android studio应用的时候同步更改

...
android {
  ...
  buildTypes {
    ...
    debug {
      ...
      debuggable true     // 必须设置为 true
      jniDebuggable true  // 必须设置为 true
      minifyEnabled false // 必须设置为 false
    }
  }

  ...
  packagingOptions {
    ...
    // 如果不设置 doNotStrip,编译出来的安装包还是会丢失调试信息;
    // 因为我们只编译了 arm64-v8a 架构的包,所以只需要配置这一行即可
    doNotStrip "*/arm64-v8a/*.so"
  }
}
...

debug llvm的路径还得配置下

参考链接代码片段_webRTC Android源码拉取与编译  https://webrtc.mthli.com/basic/webrtc-breakpoint/

webrtc android studio 断点调试 so debug configuration 选上so的地址 到jnilibs目录下 然后

在java层打一个断点 走到nativeXX方法的时候切到lldb debug 点这里暂停Webrtc android的编译步骤  

/home/denghg/sourceCode/android_webrtc/dhg_AppRTCMobile/rtc_framework/src/main/jniLibs

Webrtc android的编译步骤到上面为止可以打上lldb命令行的debug了 然后还需要在android studio里直接图形化打c++的断点需要设置两个点 一个是symbol directories 到jni的目录

令一个是映射下源码路径 (我这是直接copy源码到rtc_framework路径下的也可以直接映射源码

下次试)

把webrtc的源码拷贝到rtc_framework/src/main 下面大概5G方便打c++的断点 [项目结构如图]

Webrtc android的编译步骤

  settings set target.source-map  ./ /home/denghg/sourceCode/android_webrtc/dhg_AppRTCMobile/rtc_framework/src/main/src

Webrtc android的编译步骤

 附一张断点图Webrtc android的编译步骤文章来源地址https://www.toymoban.com/news/detail-494397.html

到了这里,关于Webrtc android的编译步骤的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Android 下载不同版本的platform-tools

    以谷歌浏览器为例。 进入官网下载: SDK 平台工具版本说明 | Android 开发者 | Android Developers 选择不同平台进行下载最新版本。 下载完成后,进入下载内容。 右键下载成功的内容,复制链接地址。得到: 可以看到当前下载的是33.0.3版本。 如果我们需要28.0.2版本则可以修改上面

    2024年02月11日
    浏览(46)
  • 【错误记录】Android Studio 编译报错 ( Could not resolve com.android.tools.build:gradle:7.4.2. )

    在 Mac 中安装了 Android Studio , 首次创建应用运行时 , 报如下错误 : 报错信息中有提示 : Doesn’t say anything about its target Java version (required compatibility with Java 8) A problem occurred configuring root project ‘DataBinding’. Could not resolve all files for configuration ‘:classpath’. Could not resolve com.android.

    2024年02月08日
    浏览(39)
  • Cordova 12编译报错Could not resolve com.android.tools.build:gradle:7.4.2.

    一、在使用Cordova12 创建项目后编译时候报错 A problem occurred configuring root project \\\'HelloCordova\\\'. Could not resolve all files for configuration \\\':classpath\\\'.     Could not resolve com.android.tools.build:gradle:7.4.2.

    2024年02月10日
    浏览(63)
  • 【android】反编译工具以及使用方式分步骤描述

    以下是对常见 Android 反编译工具的使用方式分步骤描述: Apktool 的使用方式: 步骤一:下载并安装 Apktool,可以从官方网站(https://ibotpeaches.github.io/Apktool/)下载最新版本的 Apktool。 步骤二:使用 Apktool 反编译 APK 文件,可以使用以下命令: 其中,app.apk 是要反编译的 APK 文件

    2024年02月08日
    浏览(39)
  • Ubuntu20.04安装Nvidia驱动——4060显卡(黑屏解决方法) 1.首先禁用Nouveau(Ubuntu安装显卡驱动详细步骤)

    如果按照正常方法安装不成功(如无法连接第二屏幕,nvidia-smi无显示),先尝试在安装后不管什么方法进入桌面后在应用程序中找到NVIDIA X Server Settings,在最后一项PRIME Profiles将NVIDIA On-Demand改为Performance Mode,重启后正常,安装深度学习环境也无问题,但是我的神州刷新率还

    2024年02月05日
    浏览(70)
  • Android源码的下载,编译,刷机

    上篇说到《framework开发环境搭建》,本篇继续介绍Android源码的下载、编译、刷机 先贴上Android源码官网地址:https://source.android.com/docs/setup/start/,俗称AOSP,Android开源项目,这里我总结一下具体该怎么操作。 1、安装repo Android源码同时使用git和repo进行管理,repo是基于git的代码

    2024年02月02日
    浏览(43)
  • 【Android】系统源码下载及编译

    步骤 1 :创建一个空目录来存放源码: 步骤 2 :获取最新版本的 repo 并签出 android-8.1.0_r1 分支: 其中, android-8.1.0_r1 代表源码标记,代表我们将要获取 Android 8.1 的源码,如需查看其他版本的源码标记,可参阅 源代码标记和 build。 步骤 3 :将 Android 源码从默认清单中指定的

    2024年02月13日
    浏览(39)
  • Android AOSP源码编译——AOSP下载(一)

    一、电脑配置 Ubuntu16.04 + 16G,硬盘的大小最好大于300G (我这边是找了个win电脑装了双系统 没有使用虚拟机的方式) 二、基础环境配置 1、安装git 配置git email和name 2、安装依赖工具(需要确认的就一直y就好) 3、安装python 执行 python --version 可以看到ubuntu自带的python版本是Python 2.

    2024年02月13日
    浏览(38)
  • 国内镜像下载Android10源码并编译(实测)

    1.安装ubuntu,不会的百度,一大把。 2.安装编译环境必要软件 3.python安装可能失败,建议单独安装 4.下载repo工具,打开Terminal输入命令 5.修改~/bin/repo下的REPO_URL字段为国内镜像 6.初始化git仓库设置用户名和邮箱 7.创建存放源码的目录,并同步代码 8.拖执行报python错 “/usr/bin/

    2024年02月14日
    浏览(43)
  • Android13源码下载和编译过程详解

    作为Android开发者人人都应该有一份自己Android源码,这样我们就可以随时对自己有疑惑的地方通过亲手调试来加强理解 官方推荐配置请参考:AOSP使用入门文档,重点有如下几项: 1.1.1 硬件配置要求 至少需要 250 GB 可用磁盘空间;如果要进行构建,则还需要 150 GB。如果要进行多

    2024年02月14日
    浏览(59)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包