Version 0.5
Copyright © 2010 - 2010 Lars Vogel
29.01.2011
| Revision History | ||
|---|---|---|
| Revision 0.1 | 26.10.2010 | Lars Vogel |
| Created | ||
| Revision 0.2 - 0.5 | 12.12.2010 - 29.01.2011 | Lars Vogel |
| bug fixes and enhancements | ||
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.
Table of Contents
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
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 byte-code.
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" plugin 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".
Before posting questions, please see the vogella FAQ. If you have questions or find an error in this article please use the www.vogella.com Google Group. I have created a short list how to create good questions which might also help you.
Eclipse RCP Training (German) Eclipse RCP Training with Lars Vogel
Android Tutorial Introduction to Android Programming
GWT Tutorial Program in Java and compile to JavaScript and HTML
Eclipse RCP Tutorial Create native applications in Java
JUnit Tutorial Test your application
Git Tutorial Put everything you have under distributed version control system