我已生成 Lint 文件结果(通常名为lint-results.xml
),并在 Android Studio 中正确配置了android项目以运行声纳(使用sonar-runner
)。
当我执行sonar-runner
时,我收到了下一个错误:
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
导致这些错误的原因是什么?
答案 0 :(得分:1)
我应该深入研究lint-results.xml
文件。错误在那里得到了充分的解释。就我而言:
<?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 "debug", 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>
因此,由于依赖性问题,消息告诉我项目尚未完全构建。
解决了这个错误后,一切正常。