【问题标题】:"LintError" found processing android lint report“LintError”发现处理 android lint 报告
【发布时间】:2015-07-23 16:15:49
【问题描述】:

我已生成 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

什么可能导致这些错误?

【问题讨论】:

    标签: android android-studio sonarqube lint sonar-runner


    【解决方案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 &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>
    

    所以消息告诉我,由于依赖关系问题,该项目尚未完全构建。

    解决该错误后,一切正常。

    【讨论】:

    • 其实这是一个非常有趣的案例:android lint 插件应该向您报告错误,以避免您打开 xml 文件的痛苦调查。我为此提交了一个问题:jira.codehaus.org/browse/SONARANDRO-36
    • 感谢 @benzonico 在您的 Jira 中创建问题。有没有办法在问题得到解决时得到通知?在其他情况下,如果您能在完成后在此处更新或评论,我将不胜感激。
    • 您可以通过登录 jira 来“观看”问题,并在问题更新时收到电子邮件。
    • 帐户已创建并正在观看!
    猜你喜欢
    • 2013-12-03
    • 1970-01-01
    • 1970-01-01
    • 2014-06-15
    • 1970-01-01
    • 2012-07-21
    • 1970-01-01
    • 1970-01-01
    • 2014-08-23
    相关资源
    最近更新 更多