android 源代码中如何制作单个模块并解决依赖关系

How to make a single module and resolve the dependency in android source code

我有一份 aosp 代码副本,几天前做了一个完整的构建, 最近我把代码同步到最新,并尝试修改联系人模块中的一些代码,并尝试构建它:

mmm packages/apps/Contacts

出现错误:

1 error during configuration. Try --help-properties for help.
  Property 'jack.library.import' (in Options): element #1: The version of the library file 'out/target/common/obj/JAVA_LIBRARIES/android-support-test_intermediates/classes.jack' is not supported anymore. Library version: 3.4 - Current version: 3.5 - Minimum compatible version: 3.5
ninja: build stopped: subcommand failed.
build/core/ninja.mk:84: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

我在opengrok中搜索android-support-test,在prebuilts/misc/common/android-support-test中找到android-support-test 然后我做:

mmm prebuilts/misc/common/android-support-test/

仍然错误:

1 error during configuration. Try --help-properties for help.
  Property 'jack.classpath': element #1: The version of the library file 'out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack' is not supported anymore. Library version: 3.4 - Current version: 3.5 - Minimum compatible version: 3.5
ninja: build stopped: subcommand failed.
build/core/ninja.mk:84: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

但我在 opengrok 中找不到 sdk_23 模块。

然后我删除

out/target/common/obj/JAVA_LIBRARIES/android-support-test_intermediates/classes.jack

并做

make android-support-test

它不会重建模块。

那么,如何解决使用"mmm"构建模块时的依赖?

看起来杰克一直不喜欢你预建的 material(/out 目录),它来自完全不同的 Android 版本吗?

我建议 make clean 或者只从根存储库中删除所有 /out/ 目录。

然后从根目录执行 mma Contacts

有关 mm、mmm、mma 等的更多信息。检查 build/envsetup.sh:

Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
   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.