Reputation: 3656
I am trying to use Android lint to check some things about my project. It seems to be ignoring the lint.xml file that I am giving it, making it impossible for me to enable checks.
I am using Android Studio on Ubuntu 14.04, but I am just calling ~/Android/Sdk/tools/lint from the command line.
I am doing:
$ lint --config GF/lint.xml --html lintCheck.html GF
Scanning 7.5.0: .
Scanning 7.5.0 (Phase 2):
... (and so on) ...
Wrote HTML report to file:/home/ray/Projects/jj/lintCheck.html
Lint found 26 errors and 198 warnings
$
The report lists all of the checks that are not enabled. Here is the GF/lint.xml file that I created:
$ cat GF/lint.xml
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="HardcodedText" severity="error" />
</lint>
$
Here are the ways I have tried to call lint. In all of these cases, all of the checks say something like:
RelativeOverlap
Disabled By: Project lint.xml file
So, where is the project lint.xml file that it is referring to? I have searched in ~/Android and in all my projects and this file does not appear anywhere else.
RelativeOverlap Disabled By: Project lint.xml file
What I have tried:
$ lint --ignore MissingTranslation -Wall --html lintCheck.html GF
$ lint --ignore MissingTranslation -Wall --enable all --html lintCheck.html GF
$ lint --ignore MissingTranslation -Wall --enable Correctness,Security,Performance,Usability --html lintCheck.html GF
$ lint --ignore MissingTranslation -Wall --enable Correctness --html lintCheck.html GF
$ lint --ignore MissingTranslation -Wall --enable RelativeOverlap --html lintCheck.html GF
$ lint --enable RelativeOverlap --html lintCheck.html GF
$ lint --config GF/lint.xml --html lintCheck.html GF
$ lint --config GF/lint.xml --html lintCheck.html GF
Any suggestions would be appreciated.
Upvotes: 6
Views: 3757
Reputation: 3042
Configure the lint-options in gradle file for the lint.xml to be picked up
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet true
// if true, stop the gradle build if errors are found
abortOnError false
// do not ignore warnings
warningsAsErrors true
lintConfig file('lint.xml')
}
just put the above lintoptions in the build.gradle file of app folder
And place the lint.xml file in the app folder itself then it will be picked up
here is a screenshot of placement in studio directory:
Upvotes: 7