我使用这个插件https://github.com/mozilla/rust-android-gradle,这需要我添加
tasks.whenTaskAdded { task ->
if ((task.name == 'javaPreCompileDebug' || task.name == 'javaPreCompileRelease')) {
task.dependsOn 'cargoBuild'
}
}
我的flutter项目的构建。Gradle,当我做flutter构建时,我会问这样的问题
Starting a Gradle Daemon, 18 busy Daemons could not be reused, use --status for details
Starting a Gradle Daemon, 19 busy Daemons could not be reused, use --status for details
...
然后它不断地启动一个新的,直到我的内存溢出,计算机崩溃。如果我对代码进行注释,它就会生成。
有没有办法进行更多的调试以了解发生了什么?看看系统监视器,它启动了许多java Gradle守护进程
这是的输出的一部分。/gradlew--info--堆栈跟踪--debug assembleDebug
2022-04-24T17:14:45.981+0000 [QUIET] [system.out] > Configure project :
2022-04-24T17:14:45.981+0000 [QUIET] [system.out] Starting a Gradle Daemon, 2 busy and 23 stopped Daemons could not be reused, use --status for details
2022-04-24T17:14:51.958+0000 [LIFECYCLE] [org.gradle.cache.internal.DefaultFileLockManager]
2022-04-24T17:14:51.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-04-24T17:14:51.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-04-24T17:14:51.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-04-24T17:14:51.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-04-24T17:14:51.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-04-24T17:14:51.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-04-24T17:14:46.015+0000 [LIFECYCLE] [org.gradle.internal.logging.progress.ProgressLoggerFactory]
2022-04-24T17:14:46.015+0000 [LIFECYCLE] [org.gradle.internal.logging.progress.ProgressLoggerFactory] > Configure project :
2022-04-24T17:14:54.279+0000 [QUIET] [system.out]
2022-04-24T17:14:54.279+0000 [QUIET] [system.out] > Configure project :
2022-04-24T17:14:54.279+0000 [QUIET] [system.out] Starting a Gradle Daemon, 3 busy and 23 stopped Daemons could not be reused, use --status for details
2022-04-24T17:15:01.958+0000 [LIFECYCLE] [org.gradle.cache.internal.DefaultFileLockManager]
2022-04-24T17:15:01.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-04-24T17:15:01.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-04-24T17:15:01.958+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-04-24T17:15:01.959+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-04-24T17:15:01.959+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-04-24T17:15:01.959+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-04-24T17:14:54.315+0000 [LIFECYCLE] [org.gradle.internal.logging.progress.ProgressLoggerFactory]
2022-04-24T17:14:54.315+0000 [LIFECYCLE] [org.gradle.internal.logging.progress.ProgressLoggerFactory] > Configure project :
2022-04-24T17:15:02.379+0000 [QUIET] [system.out]
2022-04-24T17:15:02.379+0000 [QUIET] [system.out] > Configure project :
2022-04-24T17:15:02.379+0000 [QUIET] [system.out] Starting a Gradle Daemon, 4 busy and 23 stopped Daemons could not be reused, use --status for details
2022-04-24T17:15:10.279+0000 [QUIET] [system.out]
2022-04-24T17:15:10.279+0000 [QUIET] [system.out] > Configure project :
2022-04-24T17:15:10.279+0000 [QUIET] [system.out] Starting a Gradle Daemon, 5 busy and 23 stopped Daemons could not be reused, use --status for details
我的构建。格雷德尔:
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.mozilla.rust-android-gradle:plugin:0.9.2'
}
gradle版本:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
更新:
./gradlew --status
PID STATUS INFO
671 IDLE 7.4.2
1026 IDLE 7.4.2
1320 IDLE 7.4.2
2128 IDLE 7.4.2
2470 IDLE 7.4.2
2760 IDLE 7.4.2
3035 IDLE 7.4.2
Only Daemons for the current Gradle version are displayed. See https://docs.gradle.org/7.4.2/userguide/gradle_daemon.html#sec:status
更新:
java --version
openjdk 11.0.14.1 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
更新:
flutter --version
Flutter 2.10.5 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 5464c5bac7 (10 days ago) •
2022-04-18 09:55:37 -0700
Engine • revision 57d3bac3dd
Tools • Dart 2.16.2 • DevTools 2.9.2
更新:
./gradlew --status
PID STATUS INFO
7625 IDLE 7.4.2
694 STOPPED (after the daemon registry became unreadable)
977 STOPPED (after the daemon was no longer found in the daemon registry)
6270 STOPPED (other compatible daemons were started after being idle for 0 minutes and not recently used)
5976 STOPPED (other compatible daemons were started after being idle for 0 minutes and not recently used)
5689 STOPPED (other compatible daemons were started after being idle for 0 minutes and not recently used)
6548 STOPPED (other compatible daemons were started after being idle for 0 minutes and not recently used)
Only Daemons for the current Gradle version are displayed. See https://docs.gradle.org/7.4.2/userguide/gradle_daemon.html#sec:status
在无限循环中创建Gradle守护进程的问题似乎是一个连接问题,即守护进程无法连接或只有慢速连接,并且被认为是死的-因此创建一个新的守护进程时遇到相同的问题,等等,直到系统资源耗尽。
做了一些研究,在stackoverflow上发现了这一点,可能更有趣,因为它与颤振有关。解决方法是关闭共享WiFi连接/将系统用作热点。
假设这不是本地防火墙问题。
文件$GRADLE\u USER\u HOME/GRADLE。属性定义行为。
可以防止它重新启动守护程序(原因可能是插件而不是守护程序):
org.gradle.daemon.performance.enable-monitoring=false
或者可以完全禁用守护进程:
org.gradle.daemon=false
最好先用switch运行,不要使用守护进程,正如手册所建议的那样:
如果怀疑守护进程已变得不稳定,则可以简单地终止它。回想一下,可以为构建指定-no-daemon开关来防止使用守护进程。这对于诊断守护进程是否真的是问题的罪魁祸首非常有用。
当我试图用“gradle init”创建一个新的gradle项目时,它只是创建了“无限”gradle守护进程,直到我的内存已满,每个守护进程之后我都会出现以下错误: '启动Gradle守护进程时,无法重用2个繁忙和6个停止的守护进程,请使用--status了解详细信息' 当我运行gradle--诊断状态时,我得到了以下报告: 无法阻止其中一个守护进程。守护进程可能已经崩溃。 我如何解决这个问题?
我有两个Ionic 3和4的项目,每当我运行它总是卡在。 当运行gradle-status时,除了输出外,什么都不会发生: 空闲 我更新了nodejs、gradle、java/jdk和其他路径,但情况仍然相同。对于iOS来说,一切都很完美。 这是我的爱奥尼亚信息:
首先,我在删除后下载了lquidbounce的源代码。gradle和我发布了代码信息,希望你们能帮我
维基百科中守护进程的解释 守护进程是一个运行后台进程, 非交互式用户直接控制的在计算机程序 Gradle 守护进程是一个后台进程, 它运行着繁重的构建, 然后在构建等待下一次构建的之间保持自身存在. 这使得数据和代码在下一次构建前已经准备好,并存入内存中. 这显著的提高了后续构建的性能. 启用Gradle守护进程是一种节约构建时间的廉价方式. 强烈建议在所有开发机器上启用Gradle的守护进程.但
建议在开发环境中使用Gradle的守护进程,不建议在持续集成环境和构建服务器环境中使用守护进程. 守护进程可以更快的构建,这对于一个正坐在椅子前构建项目的人来说非常重要.对于CI构建来说,稳定性和可预见性是最重要的.为每个构建运行时用一个新的,完全孤立于以前的版本的程序,更加可靠。
我正在尝试运行react本机项目,但我看到一个错误,上面写着“启动一个Gradle守护进程,14个繁忙,1个不兼容,2个停止的守护进程无法重用,请使用--status了解详细信息”,之后终端保持空闲。 您好,我已经按照官方反应原生文档中概述的步骤开始了一个新的反应原生项目。一切都很完美,直到我在模拟器打开的情况下运行react-原生run-android命令。我得到了以下错误: “启动Gradle