I have an Android project checked in Sonarqube. It seems to be set up correctly with Java, Android and XML plugins I have also both Java and XML parsed:
My Gradle fragment for Sonar plugin looks like:
sonarqube {
properties {
property 'sonar.projectVersion', "$android.defaultConfig.versionName"
property 'sonar.java.source', JavaVersion.VERSION_1_8
property 'sonar.java.target', JavaVersion.VERSION_1_8
property 'sonar.sourceEncoding', 'UTF-8'
property "sonar.sources", "src/main"
property "sonar.binaries", "build/intermediates/classes/debug"
property "sonar.java.binaries", "build/intermediates/classes/debug"
property "sonar.tests", "src/test/java, src/androidTest/java"
property "sonar.java.test.binaries", "build/intermediates/classes/debug"
property "sonar.import_unknown_files", true
}
}
But anyway I still have warnings with 'Unable to find file' for xml files, even with 'sonar.import_unknown_files' enabled:
10:36:04.768 [Task worker for ':' Thread 6] DEBUG o.s.p.a.lint.AndroidLintProcessor - Processing Issue: AllowBackup
10:36:04.769 [Task worker for ':' Thread 6] WARN o.s.p.a.lint.AndroidLintProcessor - Unable to find file /home/me/project/app/src/main/AndroidManifest.xml to report issue
10:36:04.770 [Task worker for ':' Thread 6] DEBUG o.s.p.a.lint.AndroidLintProcessor - Processing Issue: UnusedResources
10:36:04.770 [Task worker for ':' Thread 6] WARN o.s.p.a.lint.AndroidLintProcessor - Unable to find file /home/me/project/app/src/main/res/drawable-v24/ic_launcher_foreground.xml to report issue
I checked different configuration with 'sonar.sources' and 'sonar.import_unknown_files' - but Sonar still cannot process Lint rules for XML files. Moreover I see all of XML files (layout, menu, etc) in Sonar except 'AndroidManifest.xml' - so files has been indexed, but even with 'src/main' in sources it did not indexed AndroidManifest.
Any ideas?
UPDATE: I thinkt taht pretty sure is that I am using Sonar 6.7.1 and Sonar Android plugin 1.1, which is unfortunately don't maintained. I tried to recompile id with the new Android Lint, but with no success. I got some errors with lint-api, need to dig deeper. Maybe this is the cause of the issue.