码迷,mamicode.com
首页 > 移动开发 > 详细

下载android源码

时间:2014-09-24 14:50:26      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   io   os   使用   ar   

http://source.android.com Step 1.按照http://source.android.com/source/initializing.html配置好android编译环境

http://source.android.com/source/downloading.html配置好repo,大概步骤如下
    $ mkdir ~/bin 
  $ PATH=~/bin:$PATH
  $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 
  $ chmod a+x ~/bin/repo
  $ mkdir WORKING_DIRECTORY 
  $ cd WORKING_DIRECTORY
  以上命令不再解释,很简单很明白。
    
Setp 3.从其他镜像获取源代码
   如果要下载最新的源代码,则执行:
  $ repo init -u git://git.omapzoom.org/platform/manifest
    如果要获取每个tag,譬如2.3.5,则可以执行:
    $ repo init -u git://git.omapzoom.org/platform/manifest -b android-2.3.5_r1
  如果你不知道具体的tag叫什么名字,那么可以在浏览器访问http://git.omapzoom.org,并点击上面的/platform/manifest链接,那么可以看到所有的tag名称.
    执行repo init过程中,可能需要填写一些个人信息,直接填写即可。
    配置好repo后,执行repo sync即可下载你所需要的源代码了。

 


下载代码出错

  1. error: Failed to connect to 2404:6800:4005:c00::52: Network is unreachable while accessing https://android.googlesource.com/mirror/manifest/info/refs  
  2. fatal: HTTP request failed  

 

解决方法

1. 浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录;

2. 点击网页上的“允许访问”,得到类似

  1. machine android.googlesource.com login git-jacky.rg4.net password 1/dkRiGEvvC8o8Pgg-GsM2AbMNS_32-U0Pf0_VWkYogIA 
  2. machine android-review.googlesource.com login git-jacky.rg4.net password 1/dkRiGEvvC8o8Pgg-GsM2AbMNS_32-U0Pf0_VWkYogIA 

3. 把上面那段信息追加到~/.netrc文件结尾(请检查当前用户的权限, 如果不存在此文件则自己新建一个);

4. 下载地址的URI更改为https://android.googlesource.com/a/platform/manifest(中间加上了“/a”)。

5. repo init -u https://android.googlesource.com/a/platform/manifest -b android-4.0.3_r1

6. repo sync

即可拉下Android源码。

官方的说法是:因为访问基本是匿名的,为了防止连接过多(指内网/虚拟机),对同一IP地址的连接数做了一定的限制。看来是用gmail帐号进行认证。

这样的话,在公司网络内或者用虚拟机下载的话,会经常遇到这问题。

源码官网指导网址: http://source.android.com/source/downloading.html

 


查看Android源码版本

  1. $ grep PLATFORM_VERSION build/core/version_defaults.mk  
  2. #     PLATFORM_VERSION  
  3. #     PLATFORM_VERSION_CODENAME  
  4. ifeq "" "$(PLATFORM_VERSION)"  
  5.   PLATFORM_VERSION := 4.1.2  
  6.   # SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds  
  7. ifeq "" "$(PLATFORM_VERSION_CODENAME)"  
  8.   PLATFORM_VERSION_CODENAME := REL  
  9.   ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"  
  10.     DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)  


断网时自动进行repo sync继续下载android源码


症状分析: 在Android源码下载时,经常会断掉,这时,就得重新输入repo sync,那么,有没有一种方法在断网时自动进行repo sync呢? 

解决对策:

vi  repo_sync.sh

#!/bin/bash
repo sync
while [ $? -ne 0 ]
do
repo sync
done


ubuntu10.04 amd64 git版本升级,error: Exited sync due to gc errors

 

    1. ubuntu10.04出现error:Exited sync due to gc errors解决方法  
    2.    
    3. error: Exited sync due to gc errors 解决方法  
    4.    
    5. 原因: repo 升级,不兼容GIT  1.7.2 以下的版本。  
    6.   
    7. 升级git到 1.7.2以及以上的版本, 升级方法   
    8.    
    9. 增加ppa   
    10. sudo apt-add-repository ppa:git-core/ppa   
    11. sudo apt-get update   
    12. sudo apt-get install git   
    13.    
    14. 如果本地已经安装过Git,可以使用升级命令:   
    15. sudo apt-get dist-upgrade  

下载android源码

标签:android   style   blog   http   color   io   os   使用   ar   

原文地址:http://www.cnblogs.com/kobe8/p/3990288.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!