Mac下Android源码下载教程

一、Mac默认大小写不敏感, 需要利用磁盘工具创建大小写敏感的映像

  • 进入磁盘工具->文件->新建映像->空白映像(6.0系统编译需要70GB);

  • 创建,如下图:

Mac下Android源码下载教程_第1张图片
  • 点击‘存储’完成创建;

二、命令行进入创建的映像

  • 输入命令 hdiutil attach ~/android.dmg -mountpoint /Volumes/android 如下图:
Mac下Android源码下载教程_第2张图片
  • 进入路径 cd /Volumes/android 如下图:
Mac下Android源码下载教程_第3张图片

三、下载源码,谷歌官网:http://source.android.com/source/downloading.html,国内镜像操作:http://www.tuicool.com/articles/6ZF7Nvy

Installing Repo
  • 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 tool and ensure that it is executable:

      $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
      $ chmod a+x ~/bin/repo
    
Initializing a Repo client
  • 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 Repo with all its most recent bug fixes. You must specify a URL for the manifest, 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. For a list of branches, see Source Code Tags and Builds.

      $ repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.0_r2
    
Downloading the Android Source Tree
  • To pull down the Android source tree to your working directory from the repositories as specified in the default manifest, run

      $ repo sync

你可能感兴趣的:(Mac下Android源码下载教程)