文章目录
- 1.下载 步骤
- 1) 下载遇到问题 ,版本号的获取
- 2) 下载出现网络链接错误
- 2. 代码编译
- 3) 模拟运行
官方下载方法:google 源码获取
国内镜像下载:
清华大学开源软件镜像站
1.下载 步骤
下载 repo 并修改 镜像地址
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
REPO_URL = ‘https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/’
#REPO_URL = ‘https://gerrit.googlesource.com/git-repo’
- wget https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
- tar xvf aosp-latest.tar
- cd .repo/manifests
- git tag
- repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-10.0.0_r40
- repo sync
1) 下载遇到问题 ,版本号的获取
对于第三步 对于想下载的源码可以访问这个网址:
代号、标记和细分版本号
也可以进入 .repo/manifests 目录
执行
git tag
得到可以拉取的所有源码版本
2) 下载出现网络链接错误
(1) 打开 代码目录 .repo/manifest.xml 文件
<manifest>
<remote name="aosp"
- fetch="https://android.googlesource.com"
+ fetch="https://aosp.tuna.tsinghua.edu.cn"
review="android-review.googlesource.com" />
<remote name="github"
(2) 打开 代码目录 .repo/manifests.git/config
url = https://android.googlesource.com/platform/manifest
更改为
url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest
2. 代码编译
运行:
- source build/envsetup.sh
- lunch 15 (我选的是模拟器 x86de 一个 分支)
- make -j8
- 编译完成
3) 模拟运行
- 直接运行 命令
emulator - 使用别的 模拟器运行
比如 我使用 Android studio 自带的 模拟器.
运行参数如下:
./emulator -avd phone -system /home/lum/code/android_9_20/aosp/out/target/product/mini-emulator-x86_64/system.img
参考文件:
清华大学开源软件镜像站
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
下载Android源代码错误汇总分析
repo下载中国科技技术大学镜像android源码