I have a gradle file that includes checkstyle like so
apply plugin: 'checkstyle'
check.dependsOn 'checkstyle'
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/xdesign_checkstyle_auto.xml")
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = true
}
classpath = files()
}
In this I have a task called checkstyle where I run the checkstyle plugin to check my code for problems.
I currently have my code in a state that fails the checkstyle tests. When I run gradle build
I see that this is true.
However when I just hit the 'play' button in Android Studio to build a debug APK the check is never run and the build is successful. I expect the build to fail if there are any errors such as when I do a gradle build
.
How can I make Android Studio run gradle check
when I build a debug APK?
To make Android Studio run gradle check
:
:app:check
. In addition, you can try Android Check plugin ( https://github.com/noveogroup/android-check ). It has Checkstyle and PMD configurations from-the-box and automatically adds corresponding source checking to standard check
task.
Usage:
buildscript {
repositories { jcenter() }
dependencies {
...
classpath 'com.noveogroup.android:check:+'
...
}
}
apply plugin: 'com.noveogroup.android.check'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.