Search code examples
androidandroid-studiosonarqubelintsonar-runner

"LintError" found processing android lint report


I have generated Lint file results (generally named lint-results.xml) and configured properly android project in Android Studio to run sonar (using sonar-runner).

When I execute sonar-runner I get the next errors:

INFO 13:49:02.776 > 13:49:02.776 INFO  - Sensor org.sonar.plugins.android.lint.AndroidLintSensor@5d5f10b2
INFO 13:49:02.832 > 13:49:02.832 INFO  - Processing android lint report: C:\Code\Android\Project\app\lint-results.xml
INFO 13:49:03.477 > 13:49:03.475 WARN  - Unable to find rule for LintError
[...]
INFO 13:49:03.505 > 13:49:03.505 WARN  - Unable to find file C:\Code\Android\Project\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\7.3.0\AndroidManifest.xml to report issue
[...]
INFO 13:49:04.678 > 13:49:04.678 INFO  - Sensor org.sonar.plugins.android.lint.AndroidLintSensor@5d5f10b2 (done) | time=1902ms

What can be causing these errors?


Solution

  • I should have taken a deeper look into lint-results.xml file. The error is fully explained there. In my case:

    <?xml version="1.0" encoding="UTF-8"?>
    <issues format="4" by="lint 24.1.2">
    
       <issue
           id="LintError"
           severity="Error"
           message="No `.class` files were found in project &quot;debug&quot;, so none of the classfile based checks could be run. Does the project need to be built first?"
           category="Lint"
           priority="10"
           summary="Lint Failure" explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.
    These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
           <location  file="C:\Code\Android\TestApp\app\build\intermediates\manifests\androidTest\debug"/>
        </issue>
    

    So the message is telling me the project has not been completely build, due to a dependencies problem.

    After solving that error, everything worked fine.