【问题标题】:Run sonar on android project: The class 'foo.bar.R$string' could not be matched to its original source file在 android 项目上运行声纳:类 'foo.bar.R$string' 无法与其原始源文件匹配
【发布时间】:2017-07-17 07:01:59
【问题描述】:

当我对我的 android 项目进行声纳分析时,我总是收到很多关于 Android 资源编译生成的 .class 文件的消息,如下所示

运行声纳:类 'foo.bar.R$string' 无法与其匹配 原始源文件。它可能是一个动态生成的类。

我猜这些消息来自 Findbugs。

我试图从声纳分析中排除 **/R.class **/R$*.class,但没有成功。

关于如何摆脱此类消息的任何想法?

【问题讨论】:

  • SonarQube 使用 Findbugs 插件吗?
  • 是的,我确实使用了那个插件

标签: android resources sonarqube findbugs


【解决方案1】:

sonar.findbugs.excludesFilters 属性解决了问题

sonarqube {
    properties {
        property 'sonar.findbugs.excludesFilters', 'findbugs-filter.xml'
    }
}

findbugs-filter.xml 是

<FindBugsFilter>
    <Match>
        <Or>
            <Class name="~.*\.R\$.*"/>
            <Class name="~.*\.Manifest\$.*"/>
        </Or>
    </Match>
</FindBugsFilter>

【讨论】:

    猜你喜欢
    • 2019-02-10
    • 2012-10-05
    • 2017-05-09
    • 2019-03-02
    • 2017-04-15
    • 2013-01-26
    • 2018-02-05
    • 2014-04-27
    • 1970-01-01
    相关资源
    最近更新 更多