`apply plugin: 'checkstyle'` has no effect

android
plugins

(Jonas) #1

Hello,

I am trying to use the checkstyle plugin, following the documentation (https://docs.gradle.org/current/userguide/checkstyle_plugin.html).

It says to simply add apply plugin: 'checkstyle' to the build script, and a few tasks should be added to the project (e.g. “checkStyleMain”).

In my case, after I add the line and run ./gradlew tasks, I don’t get those new tasks.

Is there something I am missing?


(Sterling Greene) #2

You also need the java plugin.


(Jonas) #3

Oh, you’re right. I did not expect that, for an Android project. Thanks! :slight_smile:

But then it is supposed to get the checkstyle.xml located in rootDir/config/checkstyle/checkstyle.xml, right? Because it doesn’t seem to apply anything in my case (I have indentations with 2, 3 and 4 spaces, and the checkstyle.xml says “2”).

Moreover, gradle output says :checkstyleMain NO-SOURCE =/


(Jonas) #4

Well, I am not sure it is actually right to add the java plugin to an android project. I could make checkstyle run, but without the gradle checkstyle plugin (i.e. by creating a task manually that is getting checkstyle from com.puppycrawl.tools:checkstyle:7.8.1).

It is still very unclear to me how to use checkstyle with Android correctly.