Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a particular module in the android source code

I am working on an android source code which I have downloaded from source.android.com.

After a full build I went through this site http://elinux.org/Android_Build_System which explains the android build system.

When I make changes in external/webkit code and build it with

make -j4 libwebcore it compiles the corresponding file and updates the libwebcore.so, and it save me a lot of time. The same thing is applied to applications and also for building apks.

The problem arises when I make changes in the framework and give the command as make -j4 framework its not compiling the corresponding files. Can any one help me!

like image 304
dead programmer Avatar asked Oct 30 '12 12:10

dead programmer


People also ask

How do I create a project module?

Add a new module to your project by clicking File > New > New Module. Provides a container for your app's source code, resource files, and app level settings such as the module-level build file and Android Manifest file. When you create a new project, the default module name is "app".

What is a module in Android?

Modules provide a container for your app's source code, resource files, and app level settings, such as the module-level build file and Android manifest file. Each module can be independently built, tested, and debugged. Android Studio uses modules to make it easy to add new devices to your project.

Where can I get source code for Android?

The Android source tree is located in a Git repository hosted by Google. The Git repository includes metadata for the Android source, including changes to the source and when the changes were made. This page describes how to download the source tree for a specific Android code line.

What is Android source code?

Android Open Source Project (AOSP) refers to the people, processes, and source code that make up Android. The people oversee the project and develop the source code. The processes are the tools and procedures that we use to manage the development of the software.


2 Answers

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?

like image 148
Bjarke Freund-Hansen Avatar answered Sep 25 '22 08:09

Bjarke Freund-Hansen


Here are fuller descriptions of mm, mmm, and other convenient functions provided by sourcing the build/envsetup.sh file:

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. 

Plese check build/envsetup.sh file's comments to see full list of functions.

like image 35
Wonil Avatar answered Sep 24 '22 08:09

Wonil