• android 源码下载



        最近一直在尝试下android 源码的下载,昨天晚上折腾了好久,终于成功了。其实,主要就是怎么解决google翻墙的问题。最终在网上看到的方法,就是不适用google的地址,而是从其他的网站上获取源码。现在记录下方法如下:
        1.在自己的主目录下创建bin目录,添加到环境变量中。
         

            mkdir ~/bin
            PATH=~/bin:$PATH(添加环境变量)
            chmod a+x ~/bin


        2.根据网上提供的方法,我们获取google的repo(这个应该是服务器地址)

            (1)curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo(repo 成功)
    
            (2)repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r9(进行repo操作)

        这个方法失败了,提示如下

        fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
        fatal: error [Errno 101] Network is unreachable


        看起来是因为网络需要翻墙。网上寻找其他方法
        3.获取其他服务器上的repo地址

            git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/(这个应该是获取一个网站上的信息集合,得到一个git-repo文件夹)    


        4.将步骤三中获得的repo放到~/bin目录下

            ~/bin中去 cp repo ~/bin/

        5.更改repo下的uri如下

            REPO_URL = 'git://aosp.tuna.tsinghua.edu.cn/android/git-repo'


        6.在代码文件夹中进行repo仓库拷贝

            repo init -u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest    

            执行到这一步的时候,出现了如下的问题:

    Run
            git config --global user.email "you@example.com"
            git config --global user.name "Your Name"
    
            to set your account's default identity.
            Omit --global to set the identity only in this repository.
    
            fatal: unable to auto-detect email address (got 'zhangshuli@zhangshuli.(none)')


            这里是让我们增加一个邮箱,我们只需要按照上面的命令提示,增加一下邮箱跟个人信息就够了。不过,这个东西似乎可以随便写的,应该只有你需要向服务器上传东西的时候,才会用到的(比如通知一些信息等)

        git config --global user.email "1554525476@qq.com"
        git config --global user.name "zhangshuli"


        7.最后我们使用一个脚本来执行repo sync操作
            比我我创建的脚本名称是zsl_repo.sh
            内容如下

        export PATH=~/bin:$PATH
        repo sync -j2
        if [  "$?" != "0" ]; then
                sleep 30
                repo sync -j2
       fi

     然后我们运行sh zsl_repo.sh就可以了
     这个方法最终成功的获得了源码

        上述方法参考自http://blog.csdn.net/sunao2002002/article/details/47869281

    补充:

        后来发现清华大学官网上有了更新,有更直接的方法

    摘录如下

    由于首次同步需要下载 24GB 数据,过程中任何网络故障都可能造成同步失败,我们强烈建议您使用初始化包进行初始化。

    下载 https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar,下载完成后记得根据 checksum.txt 的内容校验一下。

    由于所有代码都是从隐藏的 .repo 目录中 checkout 出来的,所以我们只保留了 .repo 目录,下载后解压 再 repo sync 一遍即可得到完整的目录。

    使用方法如下:

    wget https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
    tar xf aosp-latest.tar
    cd AOSP   # 解压得到的 AOSP 工程目录
    # 这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
    repo sync # 正常同步一遍即可得到完整目录
    # 或 repo sync -l 仅checkout代码
    

    此后,每次只需运行 repo sync 即可保持同步。 

    不过,在repo sync的时候,出现连接错误,这时候我们可以查看下.repo/manifest.xml指向的文件

    .repo/manifest.xml -> manifests/default.xml

    把default.xml中的

      <remote  name="aosp"
               fetch=".."
               review="https://aosp.tuna.tsinghua.edu.cn/" />
      <default revision="master"
               remote="aosp"
               sync-j="4" />

    review改成清华地址即可

  • 相关阅读:
    序列JSON数据和四种AJAX操作方式
    jquery.validate和jquery.form.js实现表单提交
    JQuery Validate使用总结1:
    HOWTO: Include Base64 Encoded Binary Image Data (data URI scheme) in Inline Cascading Style Sheets (CSS)(转)
    SharePoint 2007 使用4.0 .Net
    动态IP解决方案
    取MS CRM表单的URL
    从Iframe或新开的窗口访问MS CRM 2011(转)
    Toggle or Hidden MS CRM Tab
    Windows 2008下修改域用户密码
  • 原文地址:https://www.cnblogs.com/zhangshuli-1989/p/zsl_2016_3_20_11_17.html
Copyright © 2020-2023  润新知