• Make sure you have a bin/ directory in your home directory, and that it is included in your path:

    $ mkdir ~/bin$ PATH=~/bin:$PATH
  • Download the Repo script and ensure it is executable:

    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo$ chmod a+x ~/bin/repo
  • 此时可能会提示链接不上,则运行如下命令替代:
  • curl http://git-repo.googlecode.com/files/repo-1.12 > ~/bin/repo

  • Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:

    $ mkdir WORKING_DIRECTORY$ cd WORKING_DIRECTORY
  • Run repo init to bring down the latest version of Repowith all its most recent bug fixes. You must specify a URL for themanifest, which specifies where the various repositories included in the Android source will be placed within your working directory.

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

    To check out a branch other than "master", specify it with -b:

    $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r1
10-29 23:44