SonarCloud with multi module Android project (Java + Kotlin) - "gradlew sonarqube" tasks failed

We’re using Github as source control and Jenkins as CI system. Our Android project consists of Java (66%) and Kotlin (34%), it’s split into multiple modules (>10) and we’re using Kotlin KTS for syncing dependencies. Java 8, Android studio 4.1, Kotlin 1.4.30.

I’ve managed to sync the dependency. When I run “gradlew sonarqube” command in the terminal, it runs for around 50s and then fails with 5 errors, all of them like this, where “note” is a module and the rest 4 modules.

FAILURE: Build completed with 5 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ‘:note:processDebugAndroidTestResources’.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
{{path}}\build\intermediates\packaged_res\debug\drawable\theme_turqouise_spinner_background_holo_light.xml:18: AAPT: error: resource drawable/theme_turqouise_spinner_disabled_holo_light (aka com.repsly.note.test:draw
able/theme_turqouise_spinner_disabled_holo_light) not found.

Also, I can build and run the app on emulator on every run. But Sonarqube scan has problems, have no idea what to try or fix. Have someone encountered similar issue?

Hello @tosulc,

Welcome to the community!

As I can see from your log, there is a problem with the task :note:processDebugAndroidTestResources and the reason is that resource drawable/theme_turqouise_spinner_disabled_holo_light (aka com.repsly.note.test:draw able/theme_turqouise_spinner_disabled_holo_light) not found. So the problem is not in sonarqube command itself but in the depending tasks.

Could you, please, execute these commands and tell us the output of it:

  • ./gradlew build

  • ./gradlew build -x :note:processDebugAndroidTestResources

  • ./gradlew build -x test

  • ./gradlew sonarqube -x :note:processDebugAndroidTestResources

  • ./gradlew sonarqube -x test

Regards,
Margarita

Hello @Margarita_Nedzelska.

I’ve managed to setup the SonarCloud for one big module where all the legacy code is, for now.

When I put the Sonarcloud dependency in the root gradle file, then the problems starts. Will try these commands next week and let you know.

Thanks.