清华地址:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
- 下载repo:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod +x repo
--------------
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
- 创建保存源码的路径
mkdir android_7.1.1_r27
cd android_7.1.1_r27
mkdir android_7.0.0_r1
cd android_7.0.0_r1
mkdir android-8.0.0_r15
cd android-8.0.0_r15
mkdir android_4.3_r1
cd android_4.3_r1
mkdir android-2.2.2_r1
cd android-2.2.2_r1
- 初始化仓库:
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-7.0.0_r29
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-7.1.1_r27
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.0.0_r15
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.3_r1
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-2.2.2_r1
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r27
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-7.0.0_r1
- 最后同步源码树:
repo sync
列表
ubuntu安装python
sudo apt install python
当提示:fatal: Cannot get
https://gerrit.googlesource.com/git-repo/clone.bundle
只需要将 .repo/manifest.xml 把其中的 aosp 这个 remote 的 fetch 从 https://gerrit.googlesource.com/git-repo
改为 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/。
Please make sure git is installed and in your path.
sudo apt-get install git
- 设置用户名和密码
运行
git config --global user.email "1782980833.com"
git config --global user.name "zhaolixiang"
- 进入自己主目录,按ctrl+h.就能看见以点号开头的隐藏文件
- 设置共享文件:ubuntu输入:
mkdir gongxiang
mount -t vboxsf gongxiang gongxiang
- 从build/core/main.mk搜索jdk观察,需要的jdk版本,
例如:
# For Java 1.7/1.8, we require OpenJDK on linux and Oracle JDK on Mac OS.
- 编译源码
make
make后面的参数跟电脑的cpu有关我的使用的是-j8,也可以-j2,-j4等,2的倍数。
- 配置模拟器环境
export PATH=$PATH:~/android-8.0.0_r15/out/host/linux-x86/bin
export ANDROID_PRODUCT_OUT=~/android-8.0.0_r15/out/target/product/generic
export PATH=$PATH:~/android_7.1.1_r27/out/host/linux-x86/bin
export ANDROID_PRODUCT_OUT=~/android_7.1.1_r27/out/target/product/generic
- 运行模拟器。
emulator
完成