zoukankan      html  css  js  c++  java
  • Android编译选项eng、user、userdebug的区别

    1. eng:debug版本;2. user:release版本;3. userdebug版本:部分debug版本

    Android.mk文件中有配置项:LOCAL_MODULE_TAGS,一般配置值为:user/eng/optional/test四个值。

    那么LOCAL_MODULE_TAGS设置为不同值有何作用呢?下面是对应不同值编译的结果:

        1、user:只有在user版本时该模块才被编译进去(用户版本);

        2、eng:只有在eng版本时该模块才被编译进去(工程版本);

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

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

    其中的值可设置为1个或多个,分别对应编译选项的同一个或多个。那么eng、user、userdebug的区别是什么呢?

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

          · 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 tagged APKs

          · Sets ro.secure=1

          · Sets ro.debuggable=0

          · Sets ro.kernel.android.checkjni=1

          · adbd is enabled by default

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

          · 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 for APK modules)

          · Sets ro.secure=1

          · Sets ro.debuggable=0

          · adbd is disabled by default

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

           the same as user, except:

          · Intended for limited debugging

          · Installs modules tagged with debug

          · Sets ro.debuggable=1

          · adbd is enabled by default

    各版本之间的差异:

    (1) Debug/LOG 方面,原则上user 版本只能抓到有限的资讯,eng 可以抓到更多的资讯,Debug 能力更强,推崇使用eng 版本开发测试

    *       因user/eng 版本设置ro.secure不同,导致user 版本adb 只拥有shell 权限,而eng 版本具有root 权限

    *       MTK System LOG 在ICS 以后,在user 版本默认关闭全部LOG, 在eng 版本中默认打开,以便抓到完整的资讯

    *       在eng 版本上,LOG 量 >= user 版本的log 量,一些地方会直接check eng/user 版本来确认是否打印LOG

    *       user 版本默认关闭uart, eng 版本默认开启uart

    *       在eng 版本上,开启ANR 的predump, 会抓取ftrace,可以得到更多ANR的资讯

    *       在eng 版本上,可用rtt 抓取backtrace,可开启kdb 进行kernel debug, 可用ftrace 抓取cpu 执行场景

    *       MTK aee 在ENG 版本抓取更多的异常资讯,比如native exception 会抓取core dump 信息

    (2) 性能方面,原则上进行性能测试请使用user 版本测试

    *       user 版本为提高第一次开机速度,使用了DVM 的预优化,将dex 文件分解成可直接load 运行的odex 文件,ENG 版本不会开启这项优化

    *       更少的LOG 打印,uart 的关闭,原则上user 版本的性能要优于eng 版本

    (3) 如何确认user/eng 版本

    *       Java 层,check android.os.Build 类中的TYPE 值

    *       native 层,property_get("ro.build.type", char* value, "eng"); 然后check value 值

    *       Debug 时, adb shell getprop ro.build.type 返回值如果是user 即user 版本,eng 即eng 版本

    *       Log 确认,  mobile log/Aplog_xxxxx/versions 中查看ro.build.type 属性

    (4) 如何编译user/eng 版本

    *       默认编译是eng 版本,如果需要编译user 版本,请加入参数 -o=TARGET_BUILD_VARIANT=user 如:

            ./mk -o=TARGET_BUILD_VARIANT=user mt6577_phone new

    eng工程版本:adb默认是打开的,且设置向导是可选的。

    user用户版本:adb默认是关闭的,dex打开(提高速度)

  • 相关阅读:
    jquery实现选项卡(两句即可实现)
    常用特效积累
    jquery学习笔记
    idong常用js总结
    织梦添加幻灯片的方法
    LeetCode "Copy List with Random Pointer"
    LeetCode "Remove Nth Node From End of List"
    LeetCode "Sqrt(x)"
    LeetCode "Construct Binary Tree from Inorder and Postorder Traversal"
    LeetCode "Construct Binary Tree from Preorder and Inorder Traversal"
  • 原文地址:https://www.cnblogs.com/CVstyle/p/6391923.html
Copyright © 2011-2022 走看看