Android开发专栏

Linux 获取Android源代码

2019-12-21  本文已影响0人  牛牛爱耍酷

以Ubuntu为例,请先安装需要的包:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache unzip

然后下载java:

传送门:https://www.oracle.com/java/technologies/javase-java-archive-javase6-downloads.html

注意选 jdk-6u45-linux-x64.bin

下载下来安装:

sudo cp jdk-6u45-linux-x64.bin /usr/java/

cd /usr/java/

chmod a+x jdk-6u45-linux-x64.bin

./jdk-6u45-linux-x64.bin

执行完之后,在执行这两条命令

sudo update-alternatives -install /usr/bin/java java /usr/java/jdk1.6.0_45/bin/java 1061

sudo update-alternatives -install /usr/bin/javac javac /usr/java/jdk1.6.0_45/bin/javac 1061

接着是下载repo:

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > repo

chmod a+x repo

sudo mv repo /bin/

现在运行

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-2.3.1_r1

使用了清华大学的官方源。

如果报错:

fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle

fatal: error [Errno **]****

fatal: cloning the git-repo repository failed, will remove '.repo/repo'

那么换为下面这条指令:

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-2.3.1_r1 --repo url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo

====================

如果清华大学的镜像用不了,可用下面指令:

repo init -u git://git.omapzoom.org/platform/manifest -b android-2.3.1_r1 --repo-url=git://git.omapzoom.org/git-repo.git

===================

同步:

repo sync -j4

完成!!!

上一篇下一篇

猜你喜欢

热点阅读