How to solve **.java can not Indexed twice problem?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this
  1. SonarQube 7.8, Scanner gradle 2.7
  2. I want integrate sonarqube to android project and i follow the doc to setup sonar server and scanner. but when execute ./gradlew sonarqube command , the scanner will throw error “.java can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files”.
    there is no test folder in my current project and i have specify the ‘sonar.sources’ folder. here is my gradle sonarqube config
plugins {
    id "org.sonarqube" version "2.7"
sonarqube {
    properties {
        property 'sonar.sources', 'folderA/folderB'
        property 'sonar.exclusions', '**/res/**, **/build/**'
        property 'sonar.inclusions', '**/src/**'

I have no idea what problem with my config, any help will be appreciated.


Welcome to the community!

First, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.8 → 7.9.6 → 8.9.4 → 9.2.2 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.



Our code are temporarily not support java11, so we need using 7.8 version of sonarqube.