【问题标题】:How to build AOSP app without building all of Android?如何在不构建所有 Android 的情况下构建 AOSP 应用程序?
【发布时间】:2017-10-06 18:52:07
【问题描述】:

我已经同步了整个 Android 存储库,并按照此处的说明设置了构建环境: https://source.android.com/source/building

构建说明似乎假设您要构建整个 Android 平台。我真的对构建特定的 AOSP 应用程序很感兴趣,例如联系人、短信、相机等。我在 GitHub 上看到了股票应用程序代码的镜像,但其中似乎没有任何构建说明,例如:

https://github.com/android/platform_packages_apps_contacts https://github.com/android/platform_packages_apps_calendar

是否有执行此操作的构建指南?我是否在下载、修改和构建这个庞大的 (100+GB) 代码集时遇到问题?

【问题讨论】:

  • “我是否在下载、修改、构建这个庞大的 (100+GB) 代码集时遇到问题?” ——一般来说,是的。这些应用程序并非设计为独立于固件的其余部分而构建。
  • 明白了,我知道很可能存在一些依赖关系等,它们会将其绑定到整个 ROM 代码库中。但是一旦我开始进行自定义,我希望能够输出一个 APK 包,我不确定这是否在 AOSP 制作过程中完成,是吗?根据构建说明,它似乎会生成一个完整的 ROM 包,准备好进入模拟器或设备。
  • 正确,但该 ROM 包将包含应用程序的 APK。但是,请记住,这些 APK 无法安装在已经拥有这些软件包的设备上,并且这些 APK 可能无论如何都无法在任意设备上运行(因为这些应用倾向于使用可能不存在的非 SDK 类和方法在您正在构建的 ROM 以外的其他 ROM 上)。

标签: android build android-source


【解决方案1】:

就像你有 'mm' 来构建某个目标一样,你也可以使用 'mma' 来构建该目标及其依赖项。例如:

$ mma Settings -j16

这将扫描项目以查找 Settings 应用程序的依赖项,然后在开始构建 Settings 应用程序之前首先构建依赖项。

【讨论】:

  • 我需要从 AOSP 编译 framework/minikin 以供 NDK 使用,有什么说明吗?
【解决方案2】:

这里是编译和基于模块的编译命令:

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.

您可以在此处查找其他和更多构建命令:https://source.android.com/setup/build/building 在这里:https://elinux.org/Android_Build_System 并检查“build/envsetup.sh”文件的 cmets 以查看完整列表。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多