[Android环境搭建错误解决二]下载Android源码时,repo出现错误解决方法

具体下载源码到方法请详见:http://source.android.com/source/downloading.html#troubleshooting-network-issues

今天用repo获取android源码:

../bin/repo init -u git://android.git.kernel.org/platform/manifest.git
出现问题:
问题一:
Traceback (most recent call last):
File "./repo", line 590, in <module>
    main(sys.argv[1:])
File "./repo", line 557, in main
    _Init(args)
File "./repo", line 176, in _Init
    _CheckGitVersion()
File "./repo", line 205, in _CheckGitVersion
    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
    errread, errwrite)
File "/usr/lib/python2.5/subprocess.py", line 1147, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

原因:没有装git,faint
解决:
sudo apt-get install git
sudo apt-get install git-core

问题二:
装好了git,再次运行:
Traceback (most recent call last):
  File "/home/calvin/Android/Android2.0/source/.repo/repo/main.py", line 235, in <module>
    _Main(sys.argv[1:])
  File "/home/calvin/Android/Android2.0/source/.repo/repo/main.py", line 217, in _Main
    repo._Run(argv)
  File "/home/calvin/Android/Android2.0/source/.repo/repo/main.py", line 123, in _Run
    cmd.Execute(copts, cargs)
  File "/home/calvin/Android/Android2.0/source/.repo/repo/subcmds/init.py", line 223, in Execute
    self._ConfigureUser()
  File "/home/calvin/Android/Android2.0/source/.repo/repo/subcmds/init.py", line 165, in _ConfigureUser
    name  = self._Prompt('Your Name', mp.UserName)
  File "/home/calvin/Android/Android2.0/source/.repo/repo/project.py", line 306, in UserName
    self._LoadUserIdentity()
  File "/home/calvin/Android/Android2.0/source/.repo/repo/project.py", line 319, in _LoadUserIdentity
    u = self.bare_git.var('GIT_COMMITTER_IDENT')
  File "/home/calvin/Android/Android2.0/source/.repo/repo/project.py", line 1324, in runner
    p.stderr))
error.GitError: manifests var:
*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident  <calvin@lihao-desktop.(none)> not allowed


解决:
看来的告知自己的身份才行。
运行:
[calvin@lihao-desktop ~/Android/Android2.0/source 18:44:28]$ git config --global user.email "lihao921@gmail.com"
[calvin@lihao-desktop ~/Android/Android2.0/source 18:44:28]$ git config --global user.name "Cavin Lee"
再运行repo:
[calvin@lihao-desktop ~/Android/Android2.0/source 18:45:00]$ ../bin/repo init -u git://android.git.kernel.org/platform/manifest.git

Your Name  [Cavin Lee]:
Your Email [lihao921@gmail.com]:

Your identity is: Cavin Lee <lihao921@gmail.com>
is this correct [y/n]? y

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white
  bold     dim      ul       reverse
Enable color display in this user account (y/n)? y

repo initialized in /home/calvin/Android/Android2.0/source(出现这个提示说明成功了)

接下来同步代码:
[calvin@lihao-desktop ~/Android/Android2.0/source 18:54:50]$ ../bin/repo sync

问题三:
同步代码时不断出现诸如 remote end hung up unexpectedly错误:
Fetching projects:   1% (2/158)  
Initializing project platform/bootable/bootloader/legacy ...
fatal: The remote end hung up unexpectedly
error: Cannot fetch platform/bootable/bootloader/legacy
看样子是server的问题。
解决:
参考: http://android.amberfog.com/?p=230
http://code.google.com/p/android/issues/detail?id=4488

sudo gedit  .repo/repo/subcmds/sync.py
修改_Fetch函数为:
   def  _Fetch(self, projects):
    fetched 
=  set()
    pm 
=  Progress( ' Fetching projects ' , len(projects))
    
for  project  in  projects:
      pm.update()
      
while  True:
       
if  project.Sync_NetworkHalf():
        fetched.add(project.gitdir)
        
break
       
else :
        
print   >> sys.stderr,  ' error: Cannot fetch %s '   %  project.name
    pm.end()
    
return  fetched
注意代码缩进问题,相应的代码段缩进要完全一样。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值