gpt4 book ai didi

android-studio - 构建之前,Android Gradle运行任务

转载 作者:行者123 更新时间:2023-12-03 17:55:58 25 4
gpt4 key购买 nike

我已经将此任务放入build.gradle

apply plugin: 'checkstyle'

task checkstyle(type: Checkstyle) {
// Cleaning the old log because of the creation for the new ones
delete fileTree(dir: "${project.rootDir}/app/build/reports")
source 'src'
include '**/*.java'
exclude '**/gen/**'
// empty classpath
classpath = files()
//Do not fail build
ignoreFailures = false
}

当我尝试构建应用程序并且发现错误导致构建失败时,我希望它能够自动运行。我不确定如何以及在何处调用任务。

最佳答案

project.afterEvaluate{
assembleAcceptanceDebug.dependsOn("checkstyle")
}

这是最终的工作。当我单击以运行应用程序时,我找到了任务名称,那么问题是在评估之前该任务不存在,所以就是问题所在。现在可以了。谢谢,也感谢这个 https://discuss.gradle.org/t/how-to-define-a-preprocessing-task-for-android-build/6147

关于android-studio - 构建之前,Android Gradle运行任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37274117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com