关于android编译中的.config的来历

本文深入探讨了Android在编译过程中如何基于BoardConfig.mk中的KERNEL_DEFCONFIG选择对应的defconfig文件,并解释了.config文件作为.defconfig的超集的工作原理。通过对比两个文件的不同之处,文章提供了关于如何精确控制内核编译过程的实用指导。

android在编译过程中会根据不同的工程,基于其对应的BoardConfig.mk中的KERNEL_DEFCONFIG := xxxxxx_defconfig来选择对应的defconfig文件进行kernel的编译。

我们会看到编译过程中会将kernel中的arch/arm/configs/xxxxxx_defconfig文件复制为.config,然后基于.config对kernel进行编译。但是你若对比一下这个.config和被复制的xxxxxx_defconfig,你会发现它们有些地方是不一样的。

确切的说,这个.config文件是实际的arch/arm/configs/xxxxxx_defconfig的超集。.config除了将arch/arm/configs/xxxxxx_defconfig复制过来以外,还会将Kconfig中所有配置为:default=y的文件加进来。

所以如果你想要仅仅以arch/arm/configs/xxxxxx_defconfig为准,那就要确保那些不想被你编译进来的文件在Kconfig中没有被配置,或者配置为default=n

Loading project all files... Loading project all files success Loading project all files... Loading project all files... Loading project all files success Loading project all files success 编译 app.json 编译 ext.json 编译 2 个页面json文件 编译 app.json 编译 ext.json 编译 2 个页面json文件 编译 app.json 编译 ext.json 编译 2 个页面json文件 编译 app.json 编译 ext.json 编译 2 个页面json文件 analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json 编译 app.json 编译 ext.json 编译 2 个页面json文件 analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json getDevCodeByFileList-miniProgram 编译 pages/index/index.wxml 编译 pages/index/index.wxml 编译 pages/logs/logs.wxml 编译 pages/logs/logs.wxml getDevCodeByFileList-miniProgram 编译 app.json 编译 ext.json 编译 2 个页面json文件 getDevCodeByFileList-miniProgram 编译 app.wxss 编译 app.wxss 编译 pages/index/index.wxss 编译 pages/index/index.wxss 编译 pages/logs/logs.wxss 编译 pages/logs/logs.wxss getDevCodeByFileList-miniProgram 编译 app.js 编译 app.js 编译 utils/util.js 编译 utils/util.js getDevCodeByFileList-miniProgram 编译 pages/index/index.js 编译 pages/index/index.js 编译 app.json 编译 ext.json 编译 2 个页面json文件 analyzing codes... ignoring files: project.private.config.json,utils/util.js analyzing codes success Ignored by code analyzer: project.private.config.json,utils/util.js analyzing codes... ignoring files: project.private.config.json,utils/util.js analyzing codes success Ignored by code analyzer: project.private.config.json,utils/util.js 编译 app.json 编译 ext.json 编译 2 个页面json文件 analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json 编译 app.json 编译 ext.json 编译 2 个页面json文件 analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json analyzing codes... ignoring files: project.private.config.json analyzing codes success Ignored by code analyzer: project.private.config.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 编译 app.json app.json: 在项目根目录未找到 app.json 正在编译代码 analyzing codes... ignoring files: project.private.config.json analyzing codes success 编译打包小程序 编译 JSON 文件 app.json: 在项目根目录未找到 app.json app.json: 在项目根目录未找到 app.json
最新发布
07-26
从你提供的日志来看,**你的微信小程序项目在编译时出现了关键错误**: ``` app.json: 在项目根目录未找到 app.json ``` 这个错误意味着微信开发者工具在编译项目时,**找不到 `app.json` 这个核心配置文件**,这是导致编译失败的主要原因。 --- ## 🧩 一、问题分析 ### 1. `app.json` 是什么? `app.json` 是微信小程序的 **全局配置文件**,它定义了: - 小程序的页面路径 - 窗口表现(导航栏、背景色等) - 网络超时时间 - 是否启用下拉刷新等 如果没有这个文件,微信开发者工具无法知道你的项目结构和基本设置,所以无法继续编译。 --- ## ✅ 二、解决方案 ### ✅ 方法一:检查项目结构 确保你的项目根目录下存在 `app.json` 文件。一个标准的微信小程序项目结构如下: ``` myApp/ ├── app.js // 全局逻辑 ├── app.json // ✅ 必须存在 ├── app.wxss // 全局样式 ├── project.config.json // 项目配置 └── pages/ // 页面目录 └── index/ ├── index.js ├── index.wxml ├── index.wxss └── index.json ``` ### ✅ 方法二:手动创建 `app.json` 如果你确实丢失了该文件,可以手动创建一个基础的 `app.json`: ```json { "pages": ["pages/index/index"], "window": { "navigationBarTitleText": "传奇小游戏", "backgroundTextStyle": "light", "navigationStyle": "default" }, "style": "v2", "sitemapLocation": "sitemap.json" } ``` 将上面的内容保存为 `app.json`,并放到项目根目录中。 --- ## 🧪 三、验证步骤 1. 关闭微信开发者工具。 2. 手动检查项目根目录是否包含 `app.json`。 3. 重新打开微信开发者工具并重新加载项目。 4. 查看控制台是否还有 `app.json` 未找到的错误。 --- ## 🧱 四、其他可能的问题 ### ❗ 1. `project.config.json` 缺失或错误 虽然不是当前报错的重点,但也是项目配置的重要文件,内容如下: ```json { "description": "项目配置文件", "setting": { "urlCheck": true, "es6": true, "postcss": true, "minify": true }, "appid": "你的小程序 AppID", "projectname": "myApp", "libVersion": "2.24.7" } ``` 确保你也有这个文件。 --- ## 🧰 五、如何新建一个标准项目? 如果你不确定当前项目是否损坏,可以使用微信开发者工具新建一个标准项目: ### 步骤如下: 1. 打开微信开发者工具。 2. 点击【新建项目】。 3. 选择“不使用云服务”。 4. 填写 AppID(可使用测试号)。 5. 选择项目目录(新建一个空文件夹)。 6. 选择模板:**JavaScript 项目** 或 **TypeScript 项目**。 7. 点击【创建】,微信开发者工具会自动生成标准项目结构,包括 `app.json`。 --- ## ✅ 六、总结 | 问题 | 原因 | 解决方案 | |------|------|-----------| | 编译失败 | 缺少 `app.json` | 手动创建并填写标准内容 | | 文件重复编译 | 微信开发者工具自动监听文件变化 | 正常现象,不影响运行 | | 忽略文件警告 | `project.private.config.json` 被忽略 | 可以忽略,不影响项目运行 | --- ##
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YasinLeeX

再来一杯西湖龙井。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值