Friday, October 5, 2012

Android Source Code - Notes

,
How to compile the Android source code
This article contains a few pointer to get the Android source code and to compile the Android source code. It also looks how to download the source code for the Android Development Tools (which are Eclipse plugins). It is more a list of notes for myself. The description is based on Ubuntu.

1. Git and repo

To get the Android source code you to use two tools, Git and an additional tool called repo.
A modern version of Ubuntu has already everything necessary. Just install Git The installation of repo and the necessary steps for other platforms is described in Getting the Android Source code. After you installed the repo tool you can get the Android source code with the following command.

 
// To get the current master 
repo init -u git://android.git.kernel.org/platform/manifest.git ; repo sync ; 

The command "git branch -a" show you all available branches, e.g. froyo and gingerbread. You can checkout them via "git checkout branch_name".
To compile the code run the following command.

make 

2. Adding the framework source to Eclipse

Unfortunately Android does not provide the framework source code as part of the standard Android Installation. For example if you open the class "android.view.ViewGroup" you only see the bytecode.
After downloading the Android source code you can fix this, by creating a zip file of the Android standard Java classes and attaching this to your Android jar file. You find these classes in the "/frameworks/base/core/java" directory. Create a zip file from these classes ("zip -r source.zip android") and attach it to your Android jar .
An easier way of getting the source into your Eclipse installation is to use the "Android Sources" plug-in from http://code.google.com/p/adt-addons/ . Haris Peco maintains plugins with gives access to the Android Source code. Using the Eclipse update manager install two of his plugins.

Update site: "http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update"

and

"http://adt-addons.googlecode.com/svn/trunk/binedit/com.android.ide.eclipse.binedit.update".

0 comments to “Android Source Code - Notes ”

Post a Comment

 

Android Development Tutorials Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger Templates