Resource Roundup: Android Source Code
Much has been made of Android being open source. Strategically, this is of huge importance. Tactically, though, your average Android application development may feel somewhat locked out of the source code, simply due to volume. The entire set of Android source code takes up 2.1GB, which means learning anything from it may be as difficult as finding a needle in a haystack.
So, here’s your map to some needles of interest.
First, the source code as a whole is hosted on http://source.android.com/, and any questions you may have about the source code should go on one of the discussion groups related to the source code itself.
While the source is hosted as a roster of git repositories, your easier way to find what you want will be through the Web. There are two approaches for this:
- Use Google Code Search, restricting your search to things in the Android package. For example, you can search for references to specific classes, like SQLiteOpenHelper, via package:android SQLiteOpenHelper. This is especially useful when you want to find other classes that reference a particular class of interest (e.g., which Android built-in apps use SQLiteOpenHelper).
- Browse the source code via GitWeb.
Here are some of the more useful GitWeb trees for Android SDK developers:
- The Java classes making up the bulk of the SDK can be found in platform/frameworks/base.git, especially the api sub-tree for the public API
- The development tools, including Java-based ones like DDMS and hierarchyviewer, can be found in platform/development.git
- Each built-in application has its own GitWeb tree, such as platform/packages/apps/Camera
Browsing the trees will get you to the source code for individual classes.
If you are looking simply to reuse some code (under the Apache License 2.0), it is probably simplest to just cut-and-paste. For example, DroidEx was created by examining some of the classes that make up DDMS and hierarchyviewer, to see how they accessed the screenshot service offered by Android devices and emulators.
You might also like
Verizon has dropped the price of the Droid Bionic this week, knocking $100 off the cost only three months after it made its debut. The carrier is touting it as
Samsung is looking to scoop up a company or two to help bolster its portfolio of services and features, reports the Wall Street Journal. After losing out on Waze to
After months of waiting, Verizon customers can finally get the Nexus 6 on “the nation’s largest and most reliable 4G LTE network” starting on March 12 online, and March 19