Android source code in Windows, the easy way

PDF

Since the Android SDK doesn’t come with the source code, you need to get it manually from the Google Git repo’s. Unfortunately, the tutorial is Linux oriented and convoluted. Fortunately, us pesky Windows users have people like Brad Chow and some helpful Asian folks that provide us with a solution out of the box.

Here’s a recap:

Note: as Rahul comments, the script points to the old repository urls:

The script uses old links: open it using a text editor and replace all git://android.git.kernel.org/ with https://android.googlesource.com/

  1. Head over to msysGit and get the latest release (I got Git-1.7.6-preview20110708.exe). Install that thing with all the defaults.
  2. Execute Git Bash from the start menu folder added by the installation
  3. Much like a command prompt, you can change drives and add folders. Create a folder at the location where you want the android sources. For me this was:

    1. cd /d
    2. cd temp
    3. mkdir android_source
    4. cd android_source
  4. Now download the excellent autogit.sh shellscript created by Brad, that downloads all Android repos, to your new folder
  5. Finally, go back to the Git Bash window and execute ‘sh autogit.sh

It’ll take a while to get all of the almost 14 GB of sourcecode.

Have fun!

Tags:
  • Brad

    Hi Benny,

    Because I have change my website to blogspot and the wordpress is no longer updated, please access this website “http://bradchow.blogspot.com/2009/01/get-android-source-code-in-m-windows.html”.

    Thanks.

    Reply

  • sharmila

    hi… this is what i noticed in my git bash shell…
    i cannot overcome this….
    please help me in this regard….

    Mtech@MTECH-20 /e/temp/andy_src
    $ sh autogit.sh
    Debug mode is: DEBUG
    /e/temp/andy_src/kernel
    android_source/kernel
    Cloning into ‘lk’…
    fatal: unable to connect to android.git.kernel.org:
    android.git.kernel.org[0: 149.20.4.77]: errno=No such file or directory
    android.git.kernel.org[1: 149.20.20.141]: errno=No such file or directory

    Cloning into ‘omap’…
    fatal: unable to connect to android.git.kernel.org:
    android.git.kernel.org[0: 149.20.4.77]: errno=No such file or directory
    android.git.kernel.org[1: 149.20.20.141]: errno=No such file or directory

    Cloning into ‘experimental’…
    fatal: unable to connect to android.git.kernel.org:
    android.git.kernel.org[0: 149.20.20.141]: errno=No such file or directory
    android.git.kernel.org[1: 149.20.4.77]: errno=No such file or directory

    Cloning into ‘msm’…
    fatal: unable to connect to android.git.kernel.org:
    android.git.kernel.org[0: 149.20.20.141]: errno=No such file or directory
    android.git.kernel.org[1: 149.20.4.77]: errno=No such file or directory

    Cloning into ‘common’…
    fatal: unable to connect to android.git.kernel.org:
    android.git.kernel.org[0: 149.20.20.141]: errno=No such file or directory
    android.git.kernel.org[1: 149.20.4.77]: errno=No such file or directory

    Reply

  • Rahul

    the script uses old links …
    open it using a text editor
    replace all git://android.git.kernel.org/
    with
    https://android.googlesource.com/

    save and follow above instructions

    Reply

  • Aurelio Quezada

    Thanks a lot Benny it will really help me!!

    Reply

  • Aurelio Quezada

    Hi Benny, I have a doubt: Which version of Android does the script download? or Downloads all the branches with all the versions?

    Reply

  • KumarRahul

    Not able to access link to download ‘autogit.sh’. Please help.

    Reply

Leave a Reply