环境准备

安装ubuntu系统,或者虚拟机

源码下载

  • 首先下载 repo 工具
mkdir ~/binPATH=~/bin:$PATHcurl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo## 如果上述 URL 不可访问,可以用下面的:## curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo > ~/bin/repochmod a+x ~/bin/repo
  • 然后建立一个工作目录
mkdir androidcd android
  • 初始化仓库命令:
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest## 如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo,把 REPO_URL 一行替换成下面的:## REPO_URL = 'https://gerrit-googlesource.proxy.ustclug.org/git-repo'

编辑 ~/bin/repo文件,执行命令 gedit ~/bin/repo

  • 如果需要某个特定的 Android 版本
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-8.1.0_r9
  • 同步源码树(以后只需执行这条命令来同步)
repo sync

编译相关

cd android  //切到android目录下source build/envsetup.shlunch       //选择编译版本类型23          //针对不同类型选择序号,我这里选择23 user版make -j32   //全编,-j加快编译速度mmm packages/apps/Helloword/ //单模块编译切换到要编译的目录下 mm -Bmake clean  //清除out目录文件

附加

Android源码下载1-转载
Android源码下载2-转载
深入理解 Android 卷1-转载

更多相关文章

  1. android第一行代码实战篇——一个小错误
  2. Android(安卓)Material Design控件之CardView
  3. android anr导出崩溃文件
  4. android studio3.5.2打包,解决建议使用 "keytool -importkeystore
  5. Android中的高效率的数据库操作框架----LitePal
  6. Android配置
  7. android兼容2.2及以前版本的退出方法
  8. Android(安卓)(DiskLruCache)硬盘缓存代码实现
  9. Android(安卓)Studio:Unable to instantiate application com.an

随机推荐

  1. Android仿微信QQ群头像生成
  2. Android如何接收locale改变的消息 || loc
  3. Android(安卓)AsyncTask 完美解析 看不懂
  4. ubuntu 14.04 adb 配置及使用
  5. android 混淆后的代码还原
  6. Android自动读取短信验证码
  7. Android 编译 product 分区
  8. Android修行之路——Android程序设计基础
  9. Android多媒体--利用Service实现背景音乐
  10. 极光推送3分集成干货--Android