当前位置: 代码迷 >> Android >> 请教怎么单独编译frameworks下的某个模块
  详细解决方案

请教怎么单独编译frameworks下的某个模块

热度:103   发布时间:2016-05-01 10:36:39.0
请问如何单独编译frameworks下的某个模块?
比如,我只在frameworks\base\services\java\com\android\server\inputManager.java中的        

public VirtualKeyDefinition[] getVirtualKeyDefinitions(String deviceName) 函数中第一加了一条调试语句:

         try {
                Slog.i(TAG, "Begin get Virtualkey!");

                FileInputStream fis = new FileInputStream(
                        "/sys/board_properties/virtualkeys." + deviceName);
              ...................

该如何编译?需要用:make TARGET_PRODUCT= <product name> OMAPES=5.x -j8
编译整个android 文件系统么?

如果编译好了单个模块,是否直接放在对应文件系统目录下就行了?



------解决方案--------------------
Android中的一个应用程序可以单独编译,编译后要重新生成system.img
在源码目录下执行
. build/envsetup.sh  就多出一些命令:
- croot:   Changes directory to the top of the tree.  
- m:       Makes from the top of the tree.  
- mm:      Builds all of the modules in the current directory.  
- mmm:     Builds all of the modules in the supplied directories.  
- cgrep:   Greps on all local C/C++ files.  
- jgrep:   Greps on all local Java files.  
- resgrep: Greps on all local res/*.xml files.  
- godir:   Go to the directory containing a file. 

我们可以使用mmm来编译指定目录的模块,如编译联系人:
mmm packages/apps/Contacts/ 
或cd 至packages/apps/Contacts/
使用mm命令,可以使用make snod重新生成system.img

------解决方案--------------------
可以重新编译framework模块,如果是文件系统的话;
如果要打包成system.img的话,再make snod一下就行了
------解决方案--------------------
直接进入到源码目录下的framework/base目录,执行mm(需要在源码目录下执行. build/envsetup.sh否则找不到命令),然后把编译出来的framework.jar替换掉你的android设备里边的/system/framework下的对应文件就行,不需要完整编译。
楼主,不结贴不厚道啊!
------解决方案--------------------
frameworks\base\services\java\ 目录下有android.mk文件,在此目录下mm 就可以了。
  相关解决方案