下载Android(安卓)源码
国内被墙后如何获取android源代码
按照http://source.android.com上的步骤并不能获取android源代码,估计又是被墙了。不过经过研究发现可以从一些镜像站点上获取android源代码
Step 1.按照 http://source.android.com/source/initializing.html配置好android编译环境 Step 2.按照 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即可下载你所需要的源代码了。
下载代码出错
[html] view plain copy
- error:Failedtoconnectto2404:6800:4005:c00::52:Networkisunreachablewhileaccessinghttps://android.googlesource.com/mirror/manifest/info/refs
- fatal:HTTPrequestfailed
解决方法
1. 浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录;
2. 点击网页上的“允许访问”,得到类似
- machineandroid.googlesource.comlogingit-jacky.rg4.netpassword1/dkRiGEvvC8o8Pgg-GsM2AbMNS_32-U0Pf0_VWkYogIA
- machineandroid-review.googlesource.comlogingit-jacky.rg4.netpassword1/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源码版本
[plain] view plain copy
- $grepPLATFORM_VERSIONbuild/core/version_defaults.mk
- #PLATFORM_VERSION
- #PLATFORM_VERSION_CODENAME
- ifeq"""$(PLATFORM_VERSION)"
- PLATFORM_VERSION:=4.1.2
- #SDKversionthebranchisbasedonandPLATFORM_VERSION_CODENAMEholds
- ifeq"""$(PLATFORM_VERSION_CODENAME)"
- PLATFORM_VERSION_CODENAME:=REL
- ifeq"REL""$(PLATFORM_VERSION_CODENAME)"
- 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
[plain] view plain copy
- ubuntu10.04出现error:Exitedsyncduetogcerrors解决方法
- error:Exitedsyncduetogcerrors解决方法
- 原因:repo升级,不兼容GIT1.7.2以下的版本。
- 升级git到1.7.2以及以上的版本,升级方法
- 增加ppa
- sudoapt-add-repositoryppa:git-core/ppa
- sudoapt-getupdate
- sudoapt-getinstallgit
- 如果本地已经安装过Git,可以使用升级命令:
- sudoapt-getdist-upgrade
更多相关文章
- Unity3d获取persistentDataPath返回空的解决方案
- Android(安卓)获取天气http://write.blog.csdn.net/category
- 获取手机(ios,android)的设备唯一码(mac地址, IMEI)
- 小白学习android: google code 上源代码的下载方法
- android系统属性获取及设置
- Android获取SD卡中选中图片的路径(URL)
- Android(安卓)studio在线升级
- 网络图片浏览器
- android 8.0 (API=26) 升级适配遇到的两个问题