Building Just One Tool from Android Source (Aosp)

Building just one tool from Android source (AOSP)

cd to the top of your Android build source.

source build/envsetup.sh
cd external/srec/tools/grxmlcompile
mma

...or any directory, or sub-directory a makefile. From AOSP build/envsetup.sh

  • 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.

external/srec was removed from the platform/manifest after android-5.1.1_r4 tag. So later, if you are using a manifest such as revision 5, 6 or later, you may need to do git clone https://android.googlesource/platform/external/srec external/srec to include that directory.

AOSP Android.mk compile only one tool

make out/host/linux-x86/bin/adb

Building a particular module in the android source code

The folder frameworks contains many things, you have to be more specific about telling make what to build.

For example I made a change in:
frameworks/base/cmds/input/src/com/android/commands/input/Input.java.
Now the corresponding Android.mk file is located in:
frameworks/base/cmds/input/Android.mk, which contains a line saying: LOCAL_MODULE := input.

Thus the module being build from the source is called input, so I call:

$ make input

Which rebuilds that specific module.

As a bonus info, you can use the mmm helper and you can specify the path of the module to build like this:

$ mmm frameworks/base/cmds/input

or using mm which just builds the module in you current working directory:

$ cd frameworks/base/cmds/input
$ mm

I normally use mmm as my preferred tool.


Update

Oh, I see you might be talking specifically about the module called framework

I just tried to modify: frameworks/base/core/java/android/app/Dialog.java, and do a: make framework.

This seems to recompile the framework just fine. Which file exactly are you making changes in before running make framework ?


In response to your comment

I just tried to modify frameworks/base/core/java/android/webkit/WebView.java. mmm frameworks/base as well as make framework works perfectly fine for me.

If it does not work for you, can you update your question with additional information about which android version you are building, which commands you are typing exactly, and the output your are seeing?

CyanogenMod or AOSP: Compile a single project

If your environment has been configured by build/envsetup.sh in your android tree, you can run mmm [project_path] to build only a specific subproject. (This will require that you've built its dependencies from the tree before.)

As CommonsWare pointed out, if you're trying to build the Email app using the SDK there's more porting work to do.

Building dictool_aosp.jar from source

I assume you receive this error when you run make dictool_aosp:

make: *** No rule to make target `dictool_aosp'.  Stop.

Means there is no make target named dictool_aosp.

You could try to build dictool_aosp by checking the Android.mk of that package. Look if there is a LOCAL_MODULE definition. If there is one you can use this one for your make call. If not you can add that or simply run mm on top of your project directory you want to build.

Some useful hints:

  • You can see all make targets with: make modules
  • You can build a subproject with mm (builds all of the modules in the current directory) or use mma (builds all of the modules in the current directory with dependencies)

Host out binaries are missing when building AOSP on macos

Okay, found out that:

  1. otatools is disabled on darwin (build/make/core/Makefile).

  2. host_init_verifier is also disabled on darwin:

build/core/definitions.mk:

ifdef TARGET_BUILD_UNBUNDLED
# TODO (b/185624993): Remove the chck on TARGET_BUILD_UNBUNDLED when host_init_verifier can run
# without requiring the HIDL interface map.
$(2): $(1)
else ifneq ($(HOST_OS),darwin)
# Host init verifier doesn't exist on darwin.
$(2): \
$(1) \
$(HOST_INIT_VERIFIER) \
$(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
$(call intermediates-dir-for,ETC,passwd_system_ext)/passwd_system_ext \
$(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
$(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
$(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
$(call intermediates-dir-for,ETC,plat_property_contexts)/plat_property_contexts \
$(call intermediates-dir-for,ETC,system_ext_property_contexts)/system_ext_property_contexts \
$(call intermediates-dir-for,ETC,product_property_contexts)/product_property_contexts \
$(call intermediates-dir-for,ETC,vendor_property_contexts)/vendor_property_contexts \
$(call intermediates-dir-for,ETC,odm_property_contexts)/odm_property_contexts
$(hide) $(HOST_INIT_VERIFIER) \
-p $(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
-p $(call intermediates-dir-for,ETC,passwd_system_ext)/passwd_system_ext \
-p $(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
-p $(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
-p $(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
--property-contexts=$(call intermediates-dir-for,ETC,plat_property_contexts)/plat_property_contexts \
--property-contexts=$(call intermediates-dir-for,ETC,system_ext_property_contexts)/system_ext_property_contexts \
--property-contexts=$(call intermediates-dir-for,ETC,product_property_contexts)/product_property_contexts \
--property-contexts=$(call intermediates-dir-for,ETC,vendor_property_contexts)/vendor_property_contexts \
--property-contexts=$(call intermediates-dir-for,ETC,odm_property_contexts)/odm_property_contexts \
$$<
else
$(2): $(1)
endif
@echo "Copy init script: $$@"
$$(copy-file-to-target)
endef


Related Topics



Leave a reply



Submit