KotlinDslScriptsParameter(correlationId=782785944245786, scriptFiles=[]) with Android Studio 4.0

KotlinDslScriptsParameter(correlationId=782785944245786, scriptFiles=[]) with Android Studio 4.0

使用 Android Studio 4.0 将项目与 Gradle 文件同步时,我在构建输出中看到以下行:

KotlinDslScriptsParameter(correlationId=782841456084562, scriptFiles=[]) => StandardKotlinDslScriptsModel(scripts=[], commonModel=CommonKotlinDslScriptModel(classPath=[], sourcePath=[], implicitImports=[]), dehydratedScriptModels={}) - took 0.0 secs

我假设这是 Android Gradle 插件中的某种调试遗留问题。有什么办法可以抑制吗?

只需将 Gradle 更新为 6.2

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip

事实证明这是 Gradle <6.2 中的一个小错误,与 Android Studio 或 Android Gradle 插件没有直接关系:A println 调用导致过多的日志记录,并已在 https://github.com/gradle/gradle/issues/11730

中修复

合并PR后,debug输出默认看不到了。所以解决方案是 update Gradle Wrapper 到 6.2 或更高版本(这很可能默认包含在 Android Gradle 插件的即将发布的版本中)。

要使用 Gradle 6.2+ 测试并重新创建以前的行为,请将 org.gradle.kotlin.dsl.logging 系统 属性 设置为 true ,例如在 gradle.properties:

systemProp.org.gradle.kotlin.dsl.logging.tapi=true
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip

将此代码粘贴到您的 gradle-wrapper. 应用程序模块的属性中