前沿

最近在研究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脚本并修改权限为可执行

$ curlhttps://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 -uhttps://android.googlesource.com/platform/manifest

$ repo init -uhttps://android.googlesource.com/platform/manifest-b android-4.2_r1

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

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

Getting the files

$ repo sync

问题

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

error: Failed connect to android.googlesource.com:443;Connection refused while accessinghttps://android.googlesource.com/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.82www.googlesource.com

74.125.31.82 android.googlesource.com

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.android.com/source/downloading.html

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

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


转载于:http://www.cnblogs.com/skyseraph/archive/2013/02/26/2933981.html

更多相关文章

  1. android adb 通过adb连接制定设备
  2. android 超简单的下载功能,进度条 异步下载
  3. Android(安卓)- Eclipse 基础修改
  4. [android] No resource found that matches the given name 'The
  5. Android读写文件
  6. 几个通用的类,迷你型的Android下载框架
  7. com.android.dx.cf.iface.ParseException: bad class file magic
  8. android 超简单的下载功能,进度条 异步下载
  9. Android(安卓)读取 assets目录下的文件

随机推荐

  1. android中资源整理
  2. Android(安卓)架构组件(一)——Lifecycle
  3. Afinal框架(简介)
  4. 属性资源与Android命名空间
  5. Android中生成和扫描二维码
  6. Android(安卓)通知(使用NotificationCompa
  7. Android进程系列第八篇---LowmemoryKille
  8. Android系统利用tcpdump抓包
  9. Android开发者指南(29) ―― USB Host an
  10. Android(安卓)调用系统相机拍照保存以及