Browsing Android source code

Not too long ago, it was a manual and tedious job to browse the Android source code when developing an app in Eclipse. Google has eliminated those steps by including the option to install a source code package as one of the upgrades in a recent ADT release (r14?) That's fine if all you need to do is look at how something is implemented in the specific release (v4.0 or higher) of Android you're developing for. It doesn't solve the problem of browsing through source code changes over time.

Fortunately, there's a fairly straight forward solution to the problem of browsing the actual Android source code git repositories: gitweb. Installation and configuration is actually fairly trivial on Linux so here's the crash course:

  1. Download a copy of the Android source repository
  2. Install gitweb (apt-get install gitweb does the job on Ubuntu)
  3. Create a directory where the git repositories you want to browse will live or have symlinks to (i.e. /var/www/your-gitweb-dir) and make symlinks to the ones you want to browse (i.e. ln -s /your-android-source-dir/android/frameworks/base/.git /var/www/your-gitweb-dir/frameworks-base.git
  4. Edit /etc/gitweb.conf changing $projectroot to the directory you created in step 3 (i.e. /var/www/your-gitweb-dir). I also had to comment out the other directives in that file gitweb to work on my installation.
  5. Restart apache

That's it... now you should be able to start browsing the Android repositories (as well as any other git-based projects you've added) in your web browser at your-hostname/gitweb

Shop at Amazon and support this site

Copyright © 2006-2013 Quantoa LLC.
All rights reserved.