为什么即使源代码没有变化,Android Studio 重建项目的速度也如此之慢? [英] Why Android Studio rebuilds project so slow even when no changes in sources?
问题描述
当我对源代码进行一些更改时,Android Studio(实际上是gradle)需要重新构建项目.很明显.
When I make some changes in source code, Android Studio (actually gradle) needs to rebuild the project. It's obvious.
即使我没有对项目进行任何更改,为什么第二个构建花费的时间与第一个构建几乎相同?当我查看 GradleConsole 时,它会等待assembleDubug"任务.我认为 gradle 应该意识到没有任何变化,不应该在上面浪费太多时间.
Why the second build takes almost the same amount of time like the first build, even if I haven't made any changes in the project? When I look into GradleConsole it waits on "assembleDubug" task. I think gradle should be aware there're no changes and shouldn't waste so much time on it.
推荐答案
终于找到了解决方案:为gradle开启离线工作.
Finally, I found the solution: turn on Offline work for gradle.
或使用CLI:
./gradlew --offline assembleDebugOrWhatever
这篇关于为什么即使源代码没有变化,Android Studio 重建项目的速度也如此之慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!