当你删掉out/target目录或者使用make clean清空输出重新编译源码的时候,编译时间通常都很漫长。
其实这个问题很容易解决,Android官方为我们带来了解决方案–ccache编译器缓存。
官方这么讲:
You can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do “make clean” often, or if you frequently switch between different build products.
设置方法:
1. 在你home主目录的.bashrc中加入:
export USE_CCACHE=1
2. 如果你需要指定一个特殊的缓存目录,也需要在.bashrc中加入,不指定则为你当前用户目录下的.ccache
export CCACHE_DIR=/home/tlh/.ccache  (tlh是自己home目录)
3. MoKee OpenSource主目录中运行,50G~100G之间手动指定:
prebuilts/misc/linux-x86/ccache/ccache -M 50G   (这个地方的ccache命令时Adnroid源码中的不是编译环境中的命令,也就是说我们要找到源码中的ccache命令指定缓存区大小)

4.在修改了~/.bashrc后记得source下,不然刚刚添加的变量不会生效。


5.察看ccache的状态:

ccache -s 察看ccache状态,如下图:

6.结果:

看下图红框中系统使用的是ccache


大功告成,开始吧!

更多相关文章

  1. GitHub 标星 2.5K+!教你通过玩游戏的方式学习 VIM!
  2. 如何在后台运行Linux命令?
  3. No.11 使用firewall配置的防火墙策略的生效模式
  4. Android第三方异步网路加载库AsyncHttpClient
  5. android的图片加载几种方法
  6. android好文章或博客地址收藏
  7. adb remount bash: /usr/local/bin/adb: Permission denied
  8. Android中JNI的调用生成头文件步骤
  9. 每天一点小知识【6】

随机推荐

  1. 初学Android,图形图像之混合使用逐帧动画
  2. 2017年严重拖延着患者欠下的债
  3. android+django交互数据(同时上传图片与文
  4. windows 7配置android开发环境
  5. Android(安卓)GridView/ListView点击事件
  6. Android(安卓)Activity提供服务(被调用Ac
  7. android 定时器 总结
  8. Android下拉刷新完全解析,教你如何一分钟
  9. android studio关于 Gradle sync failed:
  10. Android使用xml文件中的array资源