Android源码编译选项eng、user、userdebug的区别

本文详细介绍了Android源码编译过程中eng、user、userdebug选项的区别,包括它们各自在不同编译场景下的功能与配置。

Android源码编译选项eng、user、userdebug的区别


1、各选项简要说明

engdebug版本

user:release版本

userDebug版本:部分debug版本

2、详细介绍

Android源码编译选项eng、user、userdebug是由Android.mk文件中的LOCAL_MODULE_TAGS配置项来决定的。其一般形式如下:

LOCAL_MODULE_TAGS := user eng optional test
各项具体说明如下:

    1user:只有在user版本时该模块才被编译进去;

    2eng:只有在eng版本时该模块才被编译进去;

    3test:只有在tests版本时该模块才被编译进去;

    4optional:在所有版本中都编译该模块进去。

    其中的值可设置为1个或多个,分别对应编译选项的同一个或多个。

enguseruserdebug的区别如下:

   1、当make eng时,也即相当于make。此时BuildTypeeng,那么其编译进去的内容包括:

      ·Intended for platform-level debugging

      ·Installs modules tagged with: eng, debug, user, and/or development

      ·Installs non-APK modules that have no tags specified

      ·Installs APKs according to the product definition files, in addition to taggedAPKs

      ·Sets ro.secure=1

      ·Sets ro.debuggable=0

      ·Sets ro.kernel.android.checkjni=1

      ·adbd is enabled by default

    2、当make user时,此时BuildTypeuser,那么其编译进去的内容包括:

      ·Intended to be the final release

      ·Installs modules tagged as user

      ·Installs non-APK modules that have no tags specified

      ·Installs APKs according to the product definition files (tags are ignored forAPK modules)

      ·Sets ro.secure=1

      ·Sets ro.debuggable=0

      ·adbd is disabled by default

    3、当make userdebug时,此时BuildTypeuserdebug,那么其编译进去的内容包括:

       thesame as user, except:

      ·Intended for limited debugging

      ·Installs modules tagged with debug

      ·Sets ro.debuggable=1

      ·adbd is enabled by default 


3、表格:

 

eng

This is the default flavor. A plain "make " is the same as "make eng ". droid is an alias foreng .

·         Installs modules tagged with: eng , debug , user , and/or development .

·         Installs non-APK modules that have no tags specified.

·         Installs APKs according to the product definition files, in addition to tagged APKs.

·         ro.secure=0

·         ro.debuggable=1

·         ro.kernel.android.checkjni=1

·         adb is enabled by default.

user

"make user "

This is the flavor intended to be the final release bits.

·         Installs modules tagged with user .

·         Installs non-APK modules that have no tags specified.

·         Installs APKs according to the product definition files; tags are ignored for APK modules.

·         ro.secure=1

·         ro.debuggable=0

·         adb is disabled by default.

userdebug

"make userdebug "

The same as user , except:

·         Also installs modules tagged with debug .

·         ro.debuggable=1

·         adb is enabled by default.






### 如何使用 `make` 命令编译 Android 源码 为了成功编译 Android 源码,需要先设置好开发环境并初始化构建脚本。以下是关于如何通过 `make` 命令来完成这一过程的具体说明。 #### 设置目标设备和编译类型 在执行 `make` 命令之前,需运行以下命令以指定本次编译的目标设备及其对应的编译配置: ```bash source build/envsetup.sh lunch <product_name>-<build_variant> ``` 其中 `<product_name>` 是指代具体硬件平台的名字,而 `<build_variant>` 则定义了编译的变体形式(如 user, userdebugeng)。此步骤非常重要,因为它决定了最终生成镜像文件的功能特性与调试选项[^3]。 #### 执行全量编译 一旦完成了上述准备工作之后,就可以利用下面这条简单的指令来进行整个项目的完全重新编译工作: ```bash make -j<N> ``` 这里的 `-j<N>` 参数表示同时开启 N 个线程进行多核并发处理操作;通常建议将其数值设定为你计算机 CPU 物理核心数再加一作为最佳实践方案以便提高效率缩短等待时间。 需要注意的是,在实际应用过程中可能会遇到各种各样的错误提示信息,这可能是因为缺少某些依赖库或者是路径变量未正确配置等原因引起的问题。如果发生这种情况,则应该仔细阅读报错详情,并按照官方文档指导逐步排查解决办法直到顺利完成全部流程为止。 另外值得注意的一点就是当我们在本地机器上保存了一份完整的 AOSP (Android Open Source Project) 数据副本以后,尽管可以借助 IDE 工具更便捷地浏览研究其内部结构逻辑关系等内容,但由于项目规模庞大复杂度高企等因素影响下往往难以直接对其进行更改后再即时预览改动后的成果表现情况。因此在这种场景之下采用基于命令行界面的传统方式反而更加适合高效稳定地达成目的需求[^1]。 对于那些希望能够在离线状态下深入探索分析 android framework 层面实现细节的朋友来说,除了可以从官方网站获取到最新版别的 tarball 文件包之外还可以考虑运用 git-repo 工具配合 scripts 脚本来自动化同步更新远程仓库中的增量变更部分至本地存储位置处从而减少不必要的重复劳动成本支出同时也提升了工作效率水平[^2]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

JerryHe

你的鼓励是我创作最大的动力

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

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

打赏作者

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

抵扣说明:

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

余额充值