Google 官方描述: USER/USERDEBUG/ENG 版本的差異, 參考alps/build/core/build-system.html 的詳細(xì)說明
eng?
This is the default flavor. A plain make is the same as make eng.
*?????? 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.
*?????? Setupwizard is optional
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.
*?????? Enable dex pre-optimization for all TARGET projects in default to speed up device first boot-up
userdebug?
make userdebug
The same as user, except:
*?????? Also installs modules tagged with debug.
*?????? ro.debuggable=1
*?????? adb is enabled by default.
MTK 補(bǔ)充說明差異:
(1) Debug/LOG 方面烈和,原則上user 版本只能抓到有限的資訊爱只,eng 可以抓到更多的資訊,Debug 能力更強(qiáng)招刹,推崇使用eng 版本開發(fā)測(cè)試
*?????? 因user/eng 版本設(shè)置ro.secure不同恬试,導(dǎo)致user 版本adb 只擁有shell 權(quán)限,而eng 版本具有root 權(quán)限
*?????? MTK System LOG 在ICS 以后疯暑,在user 版本默認(rèn)關(guān)閉全部LOG训柴, 在eng 版本中默認(rèn)打開,以便抓到完整的資訊
*?????? 在eng 版本上妇拯,LOG 量 >= user 版本的log 量幻馁,一些地方會(huì)直接check eng/user 版本來確認(rèn)是否打印LOG
*?????? user 版本默認(rèn)關(guān)閉uart, eng 版本默認(rèn)開啟uart
*?????? 在eng 版本上,開啟ANR 的predump, 會(huì)抓取ftrace越锈,可以得到更多ANR的資訊
*?????? 在eng 版本上仗嗦,可用rtt 抓取backtrace,可開啟kdb 進(jìn)行kernel debug, 可用ftrace 抓取cpu 執(zhí)行場(chǎng)景
*?????? MTK aee 在ENG 版本抓取更多的異常資訊甘凭,比如native exception 會(huì)抓取core dump 信息
(2) 性能方面稀拐,原則上進(jìn)行性能測(cè)試請(qǐng)使用user 版本測(cè)試
*?????? user 版本為提高第一次開機(jī)速度,使用了DVM 的預(yù)優(yōu)化丹弱,將dex 文件分解成可直接load 運(yùn)行的odex 文件德撬,ENG 版本不會(huì)開啟這項(xiàng)優(yōu)化
*?????? 更少的LOG 打印铲咨,uart 的關(guān)閉,原則上user 版本的性能要優(yōu)于eng 版本
(3) 如何確認(rèn)user/eng 版本
*?????? Java 層蜓洪,check android.os.Build 類中的TYPE 值
*?????? native 層纤勒,property_get("ro.build.type", char* value, "eng"); 然后check value 值
*?????? Debug 時(shí), adb shell getprop ro.build.type 返回值如果是user 即user 版本隆檀,eng 即eng 版本
*?????? Log 確認(rèn),? mobile log/Aplog_xxxxx/versions 中查看ro.build.type 屬性
(4) 如何編譯user/eng 版本
*?????? 默認(rèn)編譯是eng 版本摇天,如果需要編譯user 版本,請(qǐng)加入?yún)?shù) -o=TARGET_BUILD_VARIANT=user 如:
./mk -o=TARGET_BUILD_VARIANT=user mt6577_phone new