SonarRunner:无法找到文件警告

fra*_*pen 2 android lint sonar-runner android-studio sonarqube

我已经配置了一个Android示例应用程序项目,以便检测Lint错误并将它们包含到SonarQube服务器中.一切正常但是当我在AndroidManifest.xml(删除allowBackup行)中明确引入错误时,声纳 - 跑步者执行会显示下一个警告:

16:33:57.681 WARN  - Unable to find file C:\Code\Android\SampleApp\app\src\main\AndroidManifest.xml to report issue
Run Code Online (Sandbox Code Playgroud)

路径没问题,所以这不是问题.此外,当我制作gradle lint和写入lint-results.xml文件时,错误位置正确:

<issue
    id="AllowBackup"
    severity="Warning"
    message="Should explicitly set `android:allowBackup` to `true` or `false` (it&apos;s `true` by default, and that can have some security implications for the application&apos;s data)"
    category="Security"
    priority="3"
    summary="Missing `allowBackup` attribute"
    explanation="The allowBackup attribute determines if an application&apos;s data can be backed up and restored. It is documented at http://developer.android.com/reference/android/R.attr.html#allowBackup

By default, this flag is set to `true`. When this flag is set to `true`, application data can be backed up and restored by the user using `adb backup` and `adb restore`.

This may have security consequences for an application. `adb backup` allows users who have enabled USB debugging to copy application data off of the device. Once backed up, all application data can be read by the user. `adb restore` allows creation of application data from a source specified by the user. Following a restore, applications should not assume that the data, file permissions, and directory permissions were created by the application itself.

Setting `allowBackup=&quot;false&quot;` opts an application out of both backup and restore.

To fix this warning, decide whether your application should support backup, and explicitly set `android:allowBackup=(true|false)&quot;`"
    url="http://developer.android.com/reference/android/R.attr.html#allowBackup"
    urls="http://developer.android.com/reference/android/R.attr.html#allowBackup"
    errorLine1="    &lt;application
"
    errorLine2="    ^"
    quickfix="studio,adt">
    <location
        file="C:\Code\Android\SampleApp\app\src\main\AndroidManifest.xml"
        line="5"
        column="5"/>
</issue>
Run Code Online (Sandbox Code Playgroud)

可能导致此警告的原因以及为什么SonarQube服务器中未显示错误?

Hen*_*nry 5

我遇到过同样的问题.遵循@benzonico建议的解决方案,仍然面临着这个问题.然后我发现了我的问题.在sonar.sources中,我刚刚提到了'src'路径,但忘了'res'(在我的项目中,我在src之外有res).然后我把两个路径都放到了sonar.sources.然后所有的xml文件都被编入索引.谢谢@benzonico.