运行 Android Studio gradle build 时如何使用所有 CPU 内核/线程? [英] How to use all CPU cores/threads when running Android Studio gradle build?
问题描述
我在 Android Studio 中寻找参数或配置/Gradle,它可以设置构建,以便在构建期间使用我的所有 CPU 内核.即如果我有一个四核 CPU 并且每个核运行 8 个线程,我该如何优化构建以使用它可以获得的所有资源(当然是并行的)?
I'm looking for a parameter or configuration in Android Studio / Gradle, that can set the build so it will use all of my CPU cores during build time. i.e. If I have a quad-core CPU and each core is running 8 threads, how can I optimize the build so it will use every resource it could get (parallel of course)?
谢谢!
推荐答案
在我的项目中的 local.properties
文件中我有
in the local.properties
file in my project I have
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
另外你可以指定
org.gradle.parallel.threads
指定用于并行执行的最大线程数.它需要 org.gradle.parallel=true
.这里你可以找到更多关于它的信息
which specifies the maximum number of threads to use for parallel execution. it needs org.gradle.parallel=true
. Here you can find more information about it
这篇关于运行 Android Studio gradle build 时如何使用所有 CPU 内核/线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!