在编译指定版本(比如 75.0.3770)的 cronet-ios 时,总是出现下图的错误 is not one of the valid types:
主要错误内容为:Only source, header, and object files belong in the sources of a static_library
is not one of the valid types
ERROR at //third_party/protobuf/proto_library.gni : Only source, header, and object files belong in the sources of a static_library is not one of the valid types
sources = get_target_outputs(":$action_name")
后来定位到是缺少指定版本下特定的依赖文件,因此需要重新同步该版本的 chromium 仓库;
代码拉取方式如下:
fetch --nohooks --no-history ios // 建立 chromium 本地 git 仓库,如果已经建好可忽略此命令
git fetch origin 75.0.3770.142
git checkout -b chromium-ios-75.0.3770.142 FETCH_HEAD
在上述步骤之后再增加下面命令,下载该分支的依赖文件:
gclient sync --with_branch_heads
尝试重新编译,成功。
官方论坛也有类似的帖子:Error generating Ninja build files 。
Cronet-iOS编译错误解决
本文解决在编译指定版本Cronet-iOS时遇到的静态库源文件类型错误,通过重新同步Chromium仓库及下载依赖文件,成功解决编译问题。





