user2185573
user2185573

Reputation:

Unable to disable Android checkstyle error

I have the following output from the lint step in android.

<file name="src/main/java/com/amazon/mycomp/application/metrics/MetricsUtil.java">
    <error line="15" severity="error" message="Class MetricsUtil should be declared as final."     source="com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck"/> 
</file>

So I tried to disable the checks using the following :-

@SuppressLint("all")

in the source file.

lintOptions {
    abortOnError false
    disable 'FinalClassCheck'
}

but neither of the two work.

I honestly do not care about my class being final or not. I want my build to work. Its not failing when unit testing and/or integration testing.

I tried looking up for help in https://developer.android.com/studio/write/lint.html but nothing that came out as usable.

Please help.

Upvotes: 0

Views: 1044

Answers (1)

PedroAGSantos
PedroAGSantos

Reputation: 2346

this has to be inside of android block

android {
.
.
.
   lintOptions {
      abortOnError false
      disable 'FinalClassCheck'
  }

in Picasso they have this in there root

  plugins.apply('checkstyle')

  task('checkstyle', type: Checkstyle) {
    configFile rootProject.file('checkstyle.xml')
    source 'src/main/java'
    ignoreFailures false
    showViolations true
    include '**/*.java'

    classpath = files()
}
    }
.
.
.
afterEvaluate {
    tasks.findByName('check').dependsOn('checkstyle')
}

you check here https://github.com/square/picasso/blob/master/build.gradle and the checkstyle.xml file is also in the root

Upvotes: 0

Related Questions