Android-~/bin/repo: line 1: syntax error near unexpected token `newline
2014-03-10 20:37
661 查看
最近在下载安卓源码时老是出现各种问题,通过网上大牛给出的方法总是也解决了,先总结如下,以备查用: |
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
这步出现问题:
解决方法一:变更网址,网上贴出的有很多,我使用的是这个:
curl http://git-repo.googlecode.com/files/repo-1.13 > ~/bin/repo
解决方法二:不变更网址,修改一下/etc/hosts。通过此方法我也成功下载了repo,但后面初始化repo时还有错误,下面会提到。但还是建议修改一下/etc/hosts,以免下载源码时会出现一些奇怪的错误。
$sudo gedit /etc/hosts
在/etc/hosts中,添加一下内容:
### Google servers
74.125.31.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173 cache.pack.google.com
2.执行到
repo init -u git://android.googlesource.com/platform/manifest.git可能会出现下面的错误
~/bin/repo: line 1: syntax error near unexpected token `newline'
大牛估计从官方下载的repo文件有错误,可以重新按照1给出的网址下载一个就好了。也确实解决了,后面根据提示添加下git的个人名字和邮箱信息就好了!
其他具体的步骤这里也给一下
1.1 初始化安装环境
参考网页http://source.android.com/source/initializing.html
主要要做的就是安装jdk和安装一些软件包
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev
libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils
如果已经安装了,就不许要这步了
1.2
无论下载内核和源码,都需要进行如下操作
参考网页http://source.android.com/source/downloading.html
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://git-repo.googlecode.com/files/repo-1.13 > ~/bin/repo
$ chmod a+x ~/bin/repo
建立一个文件夹,以便下载的内容保存其中
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
然后选择自己要下载的版本,我这里选择的是4.3
~bin/repo init -u https://android.googlesource.com/platform/manifest -b android-4.3_r2.1
也可以自己选择,这样输入查找自己要下载的版本
~bin/repo init -u https://android.googlesource.com/platform/manifest
最后输入repo sync进行下载。
相关文章推荐
- Android-~/bin/repo: line 1: syntax error near unexpected token `newline' 3修改
- 用git 下载android x86出错(syntax error near unexpected token `newline',`<!DOCTYPE HTML PUBLIC "-//IETF//)
- cocos2d-x编译android版本时出现“/bin/sh: -c: line 0: syntax error near unexpected token”错误
- syntax error near unexpected token `newline'脚本无法执行
- LFS chroot后装glibc时make出错/bin/sh: command substitution: line 3: syntax error near unexpected token `)'
- repo error : line 1:syntax error near unexpected token 'newline'
- bash: syntax error near unexpected token `newline'(关键词:flask/bug)
- LFS chroot后装glibc时编译出错/bin/sh: command substitution: line 3: syntax error near unexpected token `)
- /libtool: eval: line 964: syntax error near unexpected token `|’
- /libtool: eval: line 964: syntax error near unexpected token `|’
- test.sh: line 8: syntax error near unexpected token `fi'
- 交叉编译libupnp,make时提示libtool: eval: line 944: syntax error near unexpected token `|'的解决办法
- Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"
- 编译内核出现错误提示:line 0:syntax error near unexpected token '('
- ac_desc.sh: line 3: syntax error near unexpected token `do
- : syntax error near unexpected token `done'
- cygwin 报错“syntax error near unexpected token”
- 测试sqlplus连接遇到错误 syntax error near unexpected token `('
- syntax error near unexpected token(关于跨平台非法字符(^M)的解决方法)
- shell编程报错:“syntax error near unexpected token `”