Back to Home

How to download Android source for Windows

android · windows · sdk · open source · cygwin · git · repo

How to download Android source for Windows

    In a recent post on the restoration of the Android git repository, many complained that there is no web interface for accessing the source from Windows either. This is not so, there is git for Windows and they can be easily picked up. The only thing that does not work without a kick is the repo , which is very convenient for pumping raw materials. However, a minimum kick is required, the name of the kick is Cygwin . This post is about how to install Cygwin from scratch, which packages to choose for repo to work, and how to deflate everything for Windows users. To understand the post, you need the ability to work with the console at a basic level, understand what an invitation is, be able to print text and press Enter.



    Cygwin is a POSIX userland implementation for Windows with a bunch of familiar utilities for all occasions. The installer is available for free download on the project home page - www.cygwin.com/install.html , simply called setup.exe and acts as a graphical package manager. After downloading the installer, run it. First, a bunch of standard questions: where to put, where to download archives, choosing the mirror closest to you, and so on. After specifying all the options, you need to select the necessary packages. A minimal set is required for repo to work, so we calmly leave defaults and select the following binary packages: python , git , curl , gnupg and openssl. All additional dependencies in the form of libraries and auxiliary binaries will be added to the set automatically, so you can not worry about them. Click Next, we will be shown a list of additional dependencies, agree and wait for the progress to complete. Not difficult, right? But for full work, you need to tighten a few bolts.

    The first step is to fix the binarians relocation, for some reason it’s beaten. To do this, open the usual Windows console ( Win + R , cmd , Enter ), stomp into the folder with cygwin binaries (for example, C: \ cygwin \ bin ) and run ash . Now we start the relocation process: / bin / rebaseall. It will end quickly, but will not write anything. In general, we saw the console prompt again - the process was completed. The screw console can be closed. Now all the work will be done in bash , run it ( Start -> Cygwin -> Cygwin Bash Shell ) and read on.

    Next, you need to install root certificates, cygwin comes without them. We work in the bash, do not forget? And so: The dollar sign does not need to be printed, if that. You can now follow the official Google documentation . We create a folder for repo and configure the environment: I note that with each new opening of bash, the line $ PATH = ~ / bin: $ PATH will have to be re-entered. To not do this, edit the file

    $ mkdir -p /usr/ssl/certs
    $ cd /usr/ssl/certs
    $ curl http://curl.haxx.se/ca/cacert.pem | awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print > "cert" n ".pem"}'
    $ c_rehash




    $ mkdir ~/bin
    $ PATH=~/bin:$PATH
    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo


    .bash_profile ( C: \ cygwin \ home \% USERNAME% \. bash_profile ), everything is already there, you just need to uncomment (remove the # character at the beginning of the lines) to get it: Now create a folder for the sources, initialize the repository of the master branch and download the sources : If you need to download the source from another branch, then everything is written in the docks. Also on Google docks there is information about checking the source and a lot of interesting things, but this information is not relevant to the topic of the post.

    # Set PATH so it includes user's private bin if it exists
    if [ -d "${HOME}/bin" ] ; then
    PATH="${HOME}/bin:${PATH}"
    fi




    $ cd ~/
    $ mkdir android
    $ cd android
    $ repo init -u https://android.googlesource.com/platform/manifest
    $ repo sync




    Conclusion: downloading Android source code under Windows is as easy as downloading Linux. You will have to install additional packages in both cases, and under Windows there are only two small additional steps - relocation of binaries addresses and installation of root certificates for cygwin.

    And now - DISCO!

    Read Next