编译LineageOS模拟器镜像,导出到AndroidStudio

版权归作者所有,如有转发,请注明文章出处:https://cyrus-studio.github.io/blog/

源码下载

LineageOS官网:https://lineageos.org/
LineageOS源码 github 地址:https://github.com/LineageOS/android
LineageOS源码国内镜像地址:https://mirrors.tuna.tsinghua.edu.cn/help/lineageOS/

源码大概需要150GB的硬盘空间,编译完成差不多300G
截图.png

1. 配置git

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

2. 安装 repo

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

3. 安装 Git LFS

sudo apt install git-lfs
git lfs install

4. 设置REPO_URL

找到 repo 所在路径

which repo

编辑 repo

nano /home/cyrus/bin/repo

截图.png
可以看到repo会优先取环境变量中的REPO_URL,否则默认使用googlesource

Ctrl +X 退出nano

通过下面的命令设置 REPO_URL 环境变量,设置为清华大学镜像源,解决国内访问不了 googlesource 问题

export REPO_URL=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/

5. 下载源码

创建目录

mkdir lineageos

进入到 lineageos 目录

cd lineageos

如果可正常访问 github,使用下面的命令初始化 repo

repo init -u https://github.com/LineageOS/android.git -b lineage-21.0 --git-lfs

否则,使用清华大学镜像初始化 repo,并修改 default.xml

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b lineage-21.0 --git-lfs

打开 .repo/manifests/default.xml,将

  <remote  name="github"
           fetch=".."
           review="review.lineageos.org" />

改成

<remote  name="github"
           fetch="https://github.com/" />

<remote  name="lineage"
           fetch="https://mirrors.tuna.tsinghua.edu.cn/git/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值