zoukankan      html  css  js  c++  java
  • Mac 下 下载Android源码步骤

    android源码下载及安装:

    1.初始化安装环境:
    A。建立大小写敏感硬盘镜像:

    步骤如下:
    Disk Utility –> New Image,随便取个名字,这里用AndroidDisk,30GB足够了,然后注意选成Mac OS Extended (Case-sensitive, Journaled), –> Create
    记住保存路劲为

    ~/AndroidDisk.dmg


    B。挂载镜像:
    使用命令:
    hdiutil attach ~/AndroidDisk.dmg -mountpoint /Volumes/android
    Google的官网上推荐把这行加到~/.bash_profile里,这样以后每次用mountAndroid命令就行了。
    # mount the android file image function mountAndroid { hdiutil attach ~/AndroidDisk.dmg -mountpoint /Volumes/android; }
    (记住路径和文件名的正确书写)

    C。安装Xcode和MacPorts:
    Xcode不用多说了,MacPorts从http://www.macports.org/install.php下载:
    安装MacPorts之前需要确认环境变量PATH中,/opt/local/bin出现在/usr/bin之前,可以运行一下这行来确认:
    $ echo $PATH


    否则,就运行一下:
    $ export PATH=/opt/local/bin:$PATH

    并把上面那行加在~/.bash_profile里。

    D。从MacPorts安装make, git, and GPG packages:
    $ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupg

    如果你是Mac OS X 10.4版本的话,还要安装个bison
    $ POSIXLY_CORRECT=1 sudo port install bison

    E.下面要把gmake 3.82还原到3.81,否则之后编译源码会出错:(3.82有Bug,用不了):
    $ sudo vim /opt/local/etc/macports/sources.conf

    然后在rsync那行的上面一行加上
    file:///Users/Shared/dport

    之后按这个步骤来就行了:
    $ mkdir /Users/Shared/dports

    $ cd /Users/Shared/dports/
    $ svn co --revision 50980 http://svn.macports.org/repository/macports/trunk/dports/devel/gmake/ devel/gmake/


    $ portindex /Users/Shared/dports
    安装3.81版的:
    $ sudo port install gmake @3.81
    检查一下gmake版本,看到版本号是3.81就对了:
    $ gmake --version

    于是最后下载Android源码前的最后一步就是,修改文件标识符限制:
    由于Mac OS 默认将同时打开的文件标识符数量限制得太小,并行编译处理时可能会超出这个限制。所以在 ~/.bash_profile 里加上这么一段:
    # set the number of open files to be 1024
    ulimit -S -n 1024




    2.下载源码:
     安装Git Repo:
    $ mkdir ~/bin
    $ PATH=~/bin:$PATH
    $ curl http://android.git.kernel.org/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo
    初始化Git Repo进入开始时挂载的镜像硬盘,建立一个工作目录:
    $cd /Volumes/AndroidDisk
    $makedir WorkingSpace/
    $cd Working Space/



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

    在执行这个文件的时候,可能会出现错误,

    问题1

    但是在repo 初始化过程中却遇到一个问题
    /root/bin/repo line 1: syntax error near unexpected token `newline'
    以前也下过源码,却没有碰到过这种问题
    经过测试,重新下载
    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo
    $ repo init -u https://android.googlesource.com/platform/manifest
    $ repo sync
    注意这里是https ,不是http
    开始写成http的时候就产生了上面的问题


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


    同步文件:
    $ repo sync

    (开始下载repo里的文件——源码。于是似乎睡一觉的时间又到了。。)
    再import一个GPG public key,
    $ gpg --import


    以下是官网给出的key,输入完按Ctrl+D结束

  • 相关阅读:
    poj 1789 每个字符串不同的字母数代表两个结点间的权值 (MST)
    poj 1251 poj 1258 hdu 1863 poj 1287 poj 2421 hdu 1233 最小生成树模板题
    poj 1631 最多能有多少条不交叉的线 最大非降子序列 (LIS)
    hdu 5256 最少修改多少个数 能使原数列严格递增 (LIS)
    hdu 1025 上面n个点与下面n个点对应连线 求最多能连有多少条不相交的线 (LIS)
    Gym 100512F Funny Game (博弈+数论)
    UVa 12714 Two Points Revisited (水题,计算几何)
    UVa 12717 Fiasco (BFS模拟)
    UVa 12718 Dromicpalin Substrings (暴力)
    UVa 12716 && UVaLive 6657 GCD XOR (数论)
  • 原文地址:https://www.cnblogs.com/liyuzhao/p/3982794.html
Copyright © 2011-2022 走看看