Android如何编译userDebug版本
2016-05-10 16:45
525 查看
我们在做手机开发的时候用的都是Debug的软件,但是问题来了,有些bug现象只能在User版本中出现,而且User版本没有Root权限,所以不能开发使用,那么为了便于解决问题,怎么才能编译工程的时候让自己的工程是UserDebug版本呢。换句话说就是user版本如何打开root权限 。
这里以Android5.1的工程为例:
首先:在路径中device/gxq/gxq6735_35gc_l1/ProjectConfig.mk打开这个文件
然后:在此文件中添加MTK_BUILD_ROOT = yes
最后:编译脚本的时候用User的脚本编译即可
注意:user版本打开root权限多数是在开发的情况下使用。任何在user版本上打开root权限的做法都会给用户带来安全风险, MTK 强烈反对此类做法. 所以一般情况下只是作为开发人员使用。
其实每个项目的编译都有三种:1.eng:debug 版本 2.user: release 版本 3.userDebug版本:部分debug版本
要了解Android编译选项eng、user和userdebug的区别,需先了解下LOCAL_MODULE_TAGS这一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
这里以Android5.1的工程为例:
首先:在路径中device/gxq/gxq6735_35gc_l1/ProjectConfig.mk打开这个文件
然后:在此文件中添加MTK_BUILD_ROOT = yes
最后:编译脚本的时候用User的脚本编译即可
注意:user版本打开root权限多数是在开发的情况下使用。任何在user版本上打开root权限的做法都会给用户带来安全风险, MTK 强烈反对此类做法. 所以一般情况下只是作为开发人员使用。
其实每个项目的编译都有三种:1.eng:debug 版本 2.user: release 版本 3.userDebug版本:部分debug版本
要了解Android编译选项eng、user和userdebug的区别,需先了解下LOCAL_MODULE_TAGS这一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
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories