LineageOS 21(AOSP14) Winscope 编译运行抓取系统级日志时遇到的问题解决

编译

AOSP 旧的版本winscope就是一个静态的html页面(winscope.html),新版本同步完后是一个web项目(development/tools/winscope)
安装依赖

$ npm install
$ npm run build:prod
...
> winscope@0.0.0 build:protos
> node protos/build.js

node:internal/process/promises:392
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Failed to execute command

command: npx pbjs --force-long --target json-module --wrap es6 --out /media/ken/mhd/lineage21/development/tools/winscope/protos/../deps_build/protos/ime/latest/json.js --root ime_latest --path /media/ken/mhd/lineage21/development/tools/winscope/protos/../../../../../main/external/perfetto --path /media/ken/mhd/lineage21/development/tools/winscope/protos/.. --path /media/ken/mhd/lineage21/development/tools/winscope/protos/../../../../../main /media/ken
编译 AOSP 14Android U),常见的依赖问题通常与系统库版本、工具链兼容性、Java 版本、Python 环境以及网络同步失败有关。以下是针对这些问题的具体解决方案: ### 依赖问题解决方案 1. **系统库版本不兼容** AOSP 14 对系统库的版本要求较高,例如 `libssl`、`libgl1`、`libxrender1` 等。在 Ubuntu 系统中,可通过以下命令安装相关依赖: ```bash sudo apt-get update sudo apt-get install -y libssl-dev libgl1 libxrender1 libxext6 libgl1-mesa-glx ``` 如果使用的是较新版本的 Ubuntu(如 22.04),部分依赖可能需要通过添加旧版本仓库或使用 `aptitude` 来解决版本冲突问题[^1]。 2. **Java 版本问题** AOSP 14 编译要求使用 Java 11。若系统中安装了多个 Java 版本,需手动切换默认版本: ```bash sudo update-alternatives --config java sudo update-alternatives --config javac ``` 确保选择 `javac 11` 作为默认编译器。此外,可将 `JAVA_HOME` 环境变量设置为 Java 11 的安装路径: ```bash export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ``` 3. **Python 环境配置** AOSP 14 已逐步迁移到 Python 3,但部分构建脚本仍可能依赖 Python 2。若遇到 `python` 命令不可用的问题,可创建软链接: ```bash sudo ln -s /usr/bin/python3 /usr/bin/python ``` 同,确保安装了必要的 Python 模块: ```bash sudo apt-get install -y python3-pip python3-setuptools ``` 4. **Repo 同步失败** 在使用 `repo sync` ,如果遇到连接失败或下载中断的问题,可尝试使用清华大学镜像源加速同步过程。修改 `~/bin/repo` 文件中的 `REPO_URL` 为: ```bash REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo' ``` 同,可以使用以下脚本实现自动重试同步: ```bash repo sync -j4 while [ $? -ne 0 ]; do repo sync -j4 done ``` 5. **构建环境初始化问题** 在执行 `source build/envsetup.sh` 和 `lunch` 命令,若遇到找不到目标设备或环境变量未正确设置的问题,建议清理之前的构建配置: ```bash make clobber ``` 然后重新初始化环境并选择目标设备,例如: ```bash source build/envsetup.sh lunch aosp_x86_64-eng ``` 6. **磁盘空间不足** AOSP 14 源码体积较大,完整同步后可能占用 100GB 以上的磁盘空间。若编译过程中提示空间不足,建议使用 `make -jN`(N 为 CPU 核心数)控制并发编译任务数,或增加磁盘容量。 ### 示例编译流程(基于 x86_64 模拟器) ```bash # 下载并解压源码包 wget https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar tar xf aosp-latest.tar cd aosp # 初始化并同步源码 repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-14.0.0_rXX repo sync -j4 # 设置构建环境 source build/envsetup.sh lunch aosp_x86_64-userdebug # 开始编译 make -j$(nproc) ``` ### 注意事项 - 确保使用 `userdebug` 构建类型以便调试。 - 若使用物理设备,需根据设备型号选择合适的 lunch 目标。 - 构建过程中遇到错误,可查看 `out/error.log` 或 `make` 输出日志进行排查。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值