分享

【Android】Android 4.2源码下载(ubuntu 12.10)

 guitarhua 2013-04-25

【Android】Android 4.2源码下载(ubuntu 12.10)

前沿

    最近在研究NFC,这个不同在不同版本中API的使用都不同,想看下其源码实现,于是乎得重新下载下android源码了~~~

 

完整步骤

Installing some soft

1 Install curl:         sudo apt-get install curl

2 Install git-core:        sudo apt-get install git-core

 

Installing Repo

1 在用户目录下创建一个~/bin目录,并添加到环境变量中(要将git软件下载安装在此目录,在别的目录运行可能会找不到此软件,所以要添加到环境变量中)

$ mkdir ~/bin

$ PATH=~/bin:$PATH 

2 下载repo脚本并修改权限为可执行

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

  

Initializing a Repo client

1 创建一个保存android源码的目录,修改为最大权限,并进入到该目录下

$ mkdir /opt/android4.2

$ sudo chmod –R 777 /opt/android4.2

$ cd /opt/android4.2 

2 初始化repo,并选择要下载的分支(版本)

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

$ repo init -u https://android./platform/manifest -b android-4.2_r1

备注1:在这过程中需要输入你的姓名、邮箱等信息

备注2:查询android版本信息,参考 https://android./platform/manifest/+refs

 

Getting the files

$ repo sync

 

问题

代码下载过程中,经常提示以下错误:

error: Failed connect to android.:443;Connection refused while accessinghttps://android./a/platform/frameworks/base/info/refs

fatal: HTTP request failed

error: Cannot fetch platform/tools/motodev

error: Cannot fetch platform/frameworks/base

error: Cannot fetch platform/prebuilts/sdk

error: Exited sync due to fetch errors

解决方法:编辑/etc/hosts文件

$ vim /etc/hosts

增加下面内容,保存(提前保存好):

74.125.31.82 www.

74.125.31.82 android.

203.208.46.172 cache.pack.google.com

59.24.3.173cache.pack.google.com

然后重新输入

$ repo sync

 

 

 

Android4.2还算比较大,打包后大概9.5G左右,不打包14G左右

 

Ref:

1 Downloading the Source Tree: http://source./source/downloading.html

2 android4.2源码下载过程: http://blog.csdn.net/lengxibo/article/details/8299888#reply

http:///Android/   非常好的一个链接,里面1.6到4.2各个版本都有,如果懒得自己下载就直接在此下载

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多