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)
    gradle-config.zip (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)
debug.zip (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 com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > java.io.FileNotFoundException: 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
1.1.png
1.2.png

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

  1. build.gradle(androidapp)
    2.1.png

  2. build.gradle(app)
    2.2.png

  3. build failed
    ./gradlew sonarqube
    -Dsonar.projectKey=software_native_androidapp_AYL713jfRx6-3KqLvrHl
    -Dsonar.host.url=https://sonarqube.arnoo.com
    -Dsonar.login=50d26736e13fa84fffc5afda12bd6012edcf057e

    2.3.png

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

  1. build.gradle(app)

3.1.png

  1. build succeeded

    3.2.png

sonar.zip (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)
debug.zip (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?