Checkstyle and Android

So checkstyle works with Java plugin but not Android. According to this post, I can do something like this

task checkstyle(type: Checkstyle) {
  configFile file("${project.rootDir}/config/quality/checkstyle/checkstyle.xml") 
  configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath 
  source 'src'
  include '**/*.java'
  exclude '**/gen/**'
  classpath = files()

While I tried it, it complained about No value has been specified for property checkstyleClasspath. so I added checkstyleClasspath += classpath and then it complained about Cannot execute null+null. My class folder is in build/intermediates/classes, what’s the correct syntax for files?