升级到Android Gradle Plugin 3.2后,Gradle构建中的Findbugs失败

时间:2018-09-28 07:24:32

标签: android android-gradle gradle-plugin

错误消息:

没有要分析的文件

我的findbugs配置如下:

tasks.create([ "type" : FindBugs, "dependsOn" : "assemble", "group": "verification", "name": "findbugs"]) {
    classes = files("$projectDir.absolutePath/build/intermediates/classes")

    source = fileTree('src/main/java')
    classpath = files()
}

3 个答案:

答案 0 :(得分:8)

在AGP 3.2中,类路径似乎已从build/intermediates/classes更改为build/intermediates/javac

答案 1 :(得分:1)

task findbugs(type: FindBugs) {
    ignoreFailures = true
    classes = files("${project.rootDir}/app/build/intermediates/javac",
            "${project.rootDir}/database/build/intermediates/javac",
            "${project.rootDir}/dataprovider/build/intermediates/javac")
    source = fileTree('app/src/main/java/')
classpath = files()
    reports {
        html.enabled = true
        xml.enabled = false
    }
}

答案 2 :(得分:0)

只需从classes = fileTree("$project.buildDir/intermediates/classes/dev/debug/com/android"更改文件findbugs.gradle中的类路径 到classes = fileTree("$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes/android"