SonarScanner for Gradle BUILD FAILED

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • Community Edition V 8.9.2 (build 46101);Android Gradle Plugin Version 3.6.2;Gradle Version 5.6.4
  • what are you trying to achieve
    Implement Android Java scanning
  • what have you tried so far to achieve this
    I configured the gradle plug-in to scan the Android project according to the introduction in the official document, and found that the build failed problem. If the project does not call the sonar parameter, it can build

    log.txt (48.2 KB) (13.6 KB)

Hey there.

Can you bump up the log verbosity to get more details about where/when the failure occurs?

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

info.txt (4.6 MB) (2.9 MB)
scan.txt (31.7 KB)
thanks for your reply

hi there,please help me to see how to solve this problem,Thank you very much.

Hey there.

At a glance, the issue doesn’t appear to be related to SonarQube.

> Task :app:processCustomDebugAndroidTestResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processCustomDebugAndroidTestResources'.
> A failure occurred while executing$ActionFacade
   > D:\sonar-android\androidapp\app\build\intermediates\manifest_merge_blame_file\customDebugAndroidTest\manifest-merger-blame-custom-debug-androidTest-report.txt (œµÕ≥’“≤ªµΩ

What changes did you make do your gradle configuration files to implement analysis? If you remove just those changes, does the build suddenly work again?

step1:build without any change about this android project and it succeeded

step2:change the build.gradle and build it then failed

  1. build.gradle(androidapp)

  2. build.gradle(app)

  3. build failed
    ./gradlew sonarqube


step3:Restore build.gradle(app) configuration then build succeeded

  1. build.gradle(app)


  1. build succeeded

    3.2.png (1.8 MB)

The error message you’re citing doesn’t appear in the log files shared. Is it possible you’re only passing stdout to the log files and not stderr as well?

stacktrace.txt (14.3 KB)
info.txt (190.5 KB) (379.8 KB)

I copied the output directly from AS

And still, neither show the original error you’re referring to.

There is at least this error in stacktrace.txt\

* Exception is: org.gradle.execution.TaskSelectionException: Task 'sonarqube' not found in root project 'androidapp'.

I would suggest making sure you’ve installed the SonarQube plugin in the root project, not only the sub-project.

Sorry, I forgot to enable the sonar plugin for the above logs. I have uploaded the logs again
stacktrace.txt (33.2 KB)

I think the scanning failure is related to my multi-channel packaging with gradlew assembleCustomRelease. Is there any special configuration when the sonar plugin is adapted to multi-channel packaging?

Finally, I found that the scanning failed because of a task. I directly disabled these tasks in build.gradle that caused errors and successfully ran the scan,The specific code is as follows
gradle.taskGraph.whenReady {
tasks.each { task →
if (“AndroidTestResources”) ||“minifyCustomReleaseWithR8”) ||“shrinkCustomReleaseRes”)) {
task.enabled = false

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.