我最近开始使用 Android Studio,虽然我很喜欢它,但有一件事让我很烦恼:
Gradle - 它是一个不错的工具,但该死的它是一个资源消耗者,而且它的速度非常慢。无论我使用 5 年的旧笔记本电脑还是游戏 PC,当它运行时,其他应用程序都会完全停止(几乎)...
构建工具真的有理由如此苛刻吗???我知道编译可能是一个缓慢的过程,但根据我的经验,javac 似乎总是非常快,所以它不是问题的根源(使用 ADT 构建 Android 应用程序也快了很多倍)。 .
那我的配置有问题吗?我能让 Gradle 运行得更快吗?
最佳答案
使用以下行在项目根目录或 ~/.gradle 目录中创建一个 gradle.properties
文件:
org.gradle.daemon=true
来自Gradle manual :
The Daemon is a long-lived process, so not only are we able to avoid the cost of JVM startup for every build, but we are able to cache information about project structure, files, tasks, and more in memory
此外,如果您想在 Android Studio 中关闭持续构建,您可以转到"file">“省电模式”。
关于android - Gradle - 高 CPU 使用率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26897676/