【原创】ubuntu22.04下载编译AOSP 15
repo init -u http://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b master
source build/envsetup.sh
lunch aosp_cf_x86_64_phone-trunk_staging-userdebug
find ./ -name “index.lock” -exec rm -f {} ;
find ./ -name “index.lock” -exec rm -i {} ;
sudo find ./ -name “index.lock” -exec rm -f {} ;
repo sync -j8 --force-sync --no-clone-bundle
参数说明:-j8:多线程加速(根据网络调整)。--force-sync:强制覆盖本地文件。--no-clone-bundle:绕过 Git 分发包(避免因分发包损坏导致失败)。
repo forall -c ‘git clean -dfx; git reset --hard’
repo sync -c --no-tags -j8
定期校验源码完整性
repo forall -c ‘git fsck --full’
单独同步问题模块
repo sync -j4 device/google/gs-common
清理残留文件
repo forall -c ‘git reset --hard HEAD; git clean -fdx’
rm -rf .repo/project-objects
进入问题项目的目录(如 cd frameworks/base
)
rm -rf .git/index.lock # 确保锁文件已清除
git clean -dfx # 删除所有未跟踪文件(慎用!先备份)
git reset --hard # 强制重置到远程分支状态
git fetch --all # 重新拉取远程数据
git checkout -f # 强制切换分支(如当前分支)
git clean -dfx; git reset --hard