Set up SonarQube for Android project without building androidTests

I am trying to set up SonarQube for our Android project. We have a multi module application where some (most) modules are dependant on others. For example they require that module that is implementing them has to declare some resources. We want it that way, because we want our library modules to be customized by application modules. For example we have a module which expects application module to provide string R.string.app_name and drawable R.drawable.app_logo. Each application module can provide different app name and logo if needed. We never run android Tests for sub modules - only for application modules. We also don’t need Android Instrumentation Tests as we’re using different, cross platform (ios/android) solution for testing app behavior/visuals.

So we’ve set up our project to use sonarqube gradle plpugin v3.5.0.2730, but when we run analysis it always fails on tasks related to android tests, ex. “Execution failed for task ‘:shared-ui:processDebugAndroidTestResources’.”. This task fails, as shared-ui module contains some resources that are expected to be provided in different module as described above.

What I’d like to achieve is to disable running androidTest related tasks from SonarQube. We want to analyse our code and unit tests, but skip anything androidTest related. I’ve seen multiple posts about this, but no issue-solving answer was provided. The answer that is the closest to what we want to achieve is SonarScanner for Gradle BUILD FAILED - #11 by will_ren but in fact we want to be able to execute AndroidTests, but only for android-application modules. Besides it doesn’t work for gradle 7.0.2, which we’re using.

So is there any way to disable running androidTest related tasks for SonarQube analysis?