下载和编译Android源码问题集(持续更新)

来源:互联网 发布:做网络主播靠谱吗 编辑:程序博客网 时间:2024/04/20 07:38

1.下载repo失败

有时候,我们使用android官方方法下载最新repo的时候,总是失败,大多数原因是因为我们的网络被天朝墙了。这时可以通过设置代理的方法来解决:

设置代理

$ export http_proxy=72.64.146.136:3128

创建目录

$ mkdir ~/bin $ PATH=~/bin:$PATH

下载Repo
$ curl --proxy 72.64.146.136:3128 https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 

修改权限

$ chmod a+x ~/bin/repo

2.repo init -u 的时候出错

这时一般是因为网速过慢或者被墙,多是几次就可以了。

repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.1_r1

或者将https改为http,这样会快些

3.在repo sync过程出现“Exited sync due to fetch errors”

也是因为网络原因,重新repo sync ,以前下载过的最新的代码是不会重新下载的。

4.repo init 时如何获取对应的分支版本号

在已经下载了android源代码的目录下执行git branch -a

5.lunch中 “设备名-编译类型”

执行lunch命令

  1. Lunch menu... pick a combo:  
  2.      1. full-eng  
  3.      2.full_x86-eng  
  4.      3.vbox_x86-eng  
  5.      4.full_maguro-userdebug  
  6.      5.full_tuna-userdebug  
  7.      6.full_panda-eng 

“-”前为设备名,后面为编译类型

设备名如下(一般在vendor目录下会有支持的设备名)

crespo           表示Nexus S

crespo4g      表示Nexus S 4G

maguro         表示Google Nexus(GSM/HSPA+)

toro               表示Google Nexus(Verizon)

grouper        表示Nexus7

panda          表示PandaBoard

full                表示模拟器(注意是单独的一个full)


类型如下:

eng: 工程机
user:最终用户机
userdebug:调试测试机
tests:测试机

6.repo init -u 时不使用https,使用http

如果不是用https,而使用http的话表示取消证书认证,避免出错。

7.Nexus系列产品代号

Nexus S :crespo

Google Nexus : maguro

Nexus4 : mako

Nexus7 : grouper

Nexus10 : manta

8. 编译莫名出错

有时候是由于在之前编译了其他的工程,没有清除环境变量,然后新编译的挫工程在使用前又没有清空环境变量(比如MTK的android)导致,此时,只需要退出当前的shell,重新开启shell,然后编译即可。

9. 有时候下载源代码时出错

请参考

http://blog.csdn.net/yuyin86/article/details/6744546

10.repo命令

请参考

http://blog.csdn.net/brucexu1978/article/details/7561920

http://blog.csdn.net/wufen1103/article/details/7842719