When generating the Android lint report using ./gradlew lintDebug
, the javac lint errors such as deprecation or unchecked conversions are not included in the report.
I currently am just enabling these javac options when compiling:
(build.gradle)
tasks.withType(Compile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
But the problem with this is that the error messages are sent to the console, not to the lint report.
It is really a trivial matter, but it would be nice if all lint showed up in the same place.
My current lintDebug output:
$ ./gradlew lintDebug
:<Project Name>:preBuild
:<Project Name>:preDebugBuild
:<Project Name>:checkDebugManifest
:<Project Name>:preReleaseBuild
:<Project Name>:prepareFrAvianeyFacebookAndroidApi370Library
:<Project Name>:prepareDebugDependencies
:<Project Name>:compileDebugAidl
:<Project Name>:compileDebugRenderscript
:<Project Name>:generateDebugBuildConfig
:<Project Name>:mergeDebugAssets
:<Project Name>:generateDebugResValues UP-TO-DATE
:<Project Name>:generateDebugResources
:<Project Name>:mergeDebugResources
:<Project Name>:processDebugManifest
:<Project Name>:processDebugResources
:<Project Name>:generateDebugSources
:<Project Name>:compileDebugJava
/path/to/some/File.java:136: warning: [unchecked] unchecked conversion
Iterator<String> keyIterator = errors.keys();
^
required: Iterator<String>
found: Iterator
1 warning
:<Project Name>:compileLint
:<Project Name>:lintDebug
Wrote HTML report to file:/path/to/lint-results-debug.html
Wrote XML report to /path/to/lint-results-debug.xml
BUILD SUCCESSFUL
Total time: 3.936 secs
And my lint-results-debug.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 22.6.1">
<issue id="IconDensities" /> <!-- Along with the information about the IconDensities lint -->
</issues>
This is not possible at the moment.
Once the Android plugin is compatible with the Java plugin you'll be able to run other static analysis tools that provides a Gradle plugin (findbugs, pmd, etc...). It'll be in their own report though.
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.