Sunday, November 27, 2011

Obtaining Android Source Code on Microsoft Windows Platform

I was able to obtain the Android source code.

Here's a screenshot in Eclipse of what prompted me to go searching for the Android source code.







(really ugly when you try control-clicking on an Android API class only to get this)

Obtaining the source was MUCH more of a challenge than I expected, and took me several hours yesterday evening (plus an overnight download). Somehow I just imagined that the source would be available by Android API version as a ZIP or JAR file. Nope ...

In order to get it installed on Windows (which is officially not supported per the Android Open Source Project documentation), here's what I had to do:




  1. Install Cygwin. I installed Cygwin 1.7.9-1, the latest, obtained from cygwin.com.
  2. The setup.exe is a Web Installer. I specified C:\cygwin as my Root Directory, installed for All Users. When running setup.exe, administrator privileges are required.
  3. In the Cygwin Setup - Select Packages dialog, I found packages for curl, git, and python. These 3 will be necessary for obtaining the Android Source. This installation was a bit tricky, so I want to document this well here:

Cygwin - curl installation


Cygwin - git installation



Cygwin - Python installation


  1. From here, complete installation of Cygwin.
  2. Once Cygwin has been installed, create a local directory to hold the Android Source. In my case, I used C:\android\android-source.
  3. Open a Cygwin terminal session and type:
    cd /cygdrive/c/android/android-source
    (of course, using whatever path for your local directory).
  4. Now, type:
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/repo
    This will pull down the repo Python script used by the Android SDK Team and place it in your local directory for Android Source.
  5. Next, type:

    repo init -u https://android.googlesource.com/platform/manifest

    This will create a .repo file and initialize the directory to hold the Android Source.
  6. Finally, type:
    repo sync

    This will do the actual downloading of the Android Source. It takes a long time, and pulled down 8.72 GB into my local working directory.



No comments:

Post a Comment