在android源代码中构建特定模块

问题描述 投票:0回答:2

我正在开发一个android源代码,我已经从source.android.com下载了它。

完整构建后,我浏览了这个网站 http://elinux.org/Android_Build_System,它解释了 android 构建系统。

当我对外部/webkit 代码进行更改并使用

构建它时

make -j4 libwebcore
它编译了相应的文件并更新了libwebcore.so,它节省了我很多时间。 同样的事情也适用于应用程序和构建 apk。

当我在框架中进行更改并给出命令时,就会出现问题

make -j4 framework
它没有编译相应的文件。 谁能帮帮我吗!

android android-source
2个回答
51
投票

文件夹

frameworks
包含很多东西,你必须更具体地告诉make要构建什么。

例如我做了以下更改:

frameworks/base/cmds/input/src/com/android/commands/input/Input.java
。 现在对应的
Android.mk
文件位于:
frameworks/base/cmds/input/Android.mk
,其中包含一行:
LOCAL_MODULE := input

因此从源代码构建的模块被称为

input
,所以我调用:

$ make input

重建该特定模块。

作为奖励信息,您可以使用

mmm
帮助程序,并且可以指定要构建的模块的路径,如下所示:

$ mmm frameworks/base/cmds/input

或使用

mm
,它只是在当前工作目录中构建模块:

$ cd frameworks/base/cmds/input
$ mm

我通常使用

mmm
作为我的首选工具。


更新

哦,我发现您可能在专门谈论名为

framework

的模块

我只是尝试修改:

frameworks/base/core/java/android/app/Dialog.java
,并执行:
make framework

这似乎重新编译框架就好了。在运行之前您到底要更改哪个文件

make framework


回复您的评论

我只是尝试修改

frameworks/base/core/java/android/webkit/WebView.java
mmm frameworks/base
以及
make framework
非常适合我。

如果它不适合您,您可以使用有关您正在构建的 Android 版本、您正在准确输入哪些命令以及您看到的输出的附加信息来更新您的问题吗?


39
投票

以下是对

mm
mmm
以及通过获取
build/envsetup.sh
文件提供的其他便捷功能的更完整描述:

从 shell 调用

. build/envsetup.sh
将以下函数添加到您的环境中:

   lunch:   lunch <product_name>-<build_variant>
   tapas:   tapas [<App1> <App2> ...] [arm|x86|mips|armv5] [eng|userdebug|user]
   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, but not their dependencies.
   mmm:     Builds all of the modules in the supplied directories, but not their dependencies.
            To limit the modules being built use the syntax: mmm dir/:target1,target2.
   mma:     Builds all of the modules in the current directory, and their dependencies.
   mmma:    Builds all of the modules in the supplied directories, and their dependencies.
   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.

请检查 envsetup.sh 文件的注释以查看完整的函数列表。

© www.soinside.com 2019 - 2024. All rights reserved.