I believe this is because getCDirectories() no longer exists and has been marked as deprecated for quite a while. I think it may just be a case of removing line 399 from AndroidUtils.java
[2026-03-04T15:28:24.845Z] + ./gradlew sonar --no-parallel --stacktrace
[2026-03-04T15:28:37.675Z]
[2026-03-04T15:28:37.675Z] FAILURE: Build failed with an exception.
[2026-03-04T15:28:37.675Z]
[2026-03-04T15:28:37.675Z] * What went wrong:
[2026-03-04T15:28:37.675Z] 'java.util.Collection com.android.builder.model.SourceProvider.getCDirectories()'
[2026-03-04T15:28:37.675Z]
[2026-03-04T15:28:37.675Z] * Try:
[2026-03-04T15:28:37.675Z] > Run with --info or --debug option to get more log output.
[2026-03-04T15:28:37.675Z] > Run with --scan to get full insights from a Build Scan (powered by Develocity).
[2026-03-04T15:28:37.675Z] > Get more help at https://help.gradle.org.
[2026-03-04T15:28:37.675Z]
[2026-03-04T15:28:37.675Z] * Exception is:
[2026-03-04T15:28:37.675Z] java.lang.NoSuchMethodError: 'java.util.Collection com.android.builder.model.SourceProvider.getCDirectories()'
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.AndroidUtils.getFilesFromSourceSet(AndroidUtils.java:399)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.AndroidUtils.populateSonarQubeProps(AndroidUtils.java:332)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.AndroidUtils.configureForAndroid(AndroidUtils.java:126)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.AndroidUtils.configureForAndroid(AndroidUtils.java:86)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.SonarPropertyComputer.computeDefaultProperties(SonarPropertyComputer.java:128)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.SonarPropertyComputer.computeDefaultProperties(SonarPropertyComputer.java:178)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:111)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.SonarPropertyComputer.computeSonarProperties(SonarPropertyComputer.java:99)
[2026-03-04T15:28:37.676Z] at org.sonarqube.gradle.SonarQubePlugin.lambda$configureTask$13(SonarQubePlugin.java:169)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.DefaultProvider.calculateOwnValue(DefaultProvider.java:73)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateExecutionTimeValue(AbstractMinimalProvider.java:141)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.TransformBackedProvider.calculateExecutionTimeValue(TransformBackedProvider.java:66)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.MapCollectors$EntriesFromMapProvider.calculateExecutionTimeValue(MapCollectors.java:223)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.DefaultMapProperty$CollectingSupplier.lambda$calculateExecutionTimeValue$2(DefaultMapProperty.java:612)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.AbstractCollectingSupplier.collectExecutionTimeValues(AbstractCollectingSupplier.java:121)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.AbstractCollectingSupplier.calculateExecutionTimeValue(AbstractCollectingSupplier.java:103)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.DefaultMapProperty$CollectingSupplier.calculateExecutionTimeValue(DefaultMapProperty.java:611)
[2026-03-04T15:28:37.676Z] at org.gradle.api.internal.provider.DefaultMapProperty.calculateOwnExecutionTimeValue(DefaultMapProperty.java:365)
[2026-03-04T15:28:37.677Z] at org.gradle.api.internal.provider.DefaultMapProperty.calculateOwnExecutionTimeValue(DefaultMapProperty.java:58)
[2026-03-04T15:28:37.677Z] at org.gradle.api.internal.provider.AbstractProperty.calculateExecutionTimeValue(AbstractProperty.java:205)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.MapPropertyCodec.encodeThis(ProviderCodecs.kt:500)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.MapPropertyCodec.encodeThis(ProviderCodecs.kt:492)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.AbstractPropertyCodec.encode$suspendImpl(ProviderCodecs.kt:360)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.AbstractPropertyCodec.encode(ProviderCodecs.kt)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.AbstractPropertyCodec.encode(ProviderCodecs.kt:354)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.graph.codecs.BindingsBackedCodec.encode(BindingsBackedCodec.kt:66)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.graph.DefaultWriteContext.write(Contexts.kt:111)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.graph.BeanPropertyExtensionsKt.writePropertyValue(BeanPropertyExtensions.kt:34)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.beans.services.BeanPropertyWriter.writeStateOf(BeanPropertyWriter.kt:54)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodec$writeTask$3$2$1.invokeSuspend(TaskNodeCodec.kt:110)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodec$writeTask$3$2$1.invoke(TaskNodeCodec.kt)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodec$writeTask$3$2$1.invoke(TaskNodeCodec.kt)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodecKt.withTaskOf(TaskNodeCodec.kt:294)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodecKt.access$withTaskOf(TaskNodeCodec.kt:1)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodec.writeTask(TaskNodeCodec.kt:104)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodec.encode(TaskNodeCodec.kt:77)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.TaskNodeCodec.encode(TaskNodeCodec.kt:71)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.graph.codecs.BindingsBackedCodec.encode(BindingsBackedCodec.kt:66)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.graph.DefaultWriteContext.write(Contexts.kt:111)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$writeGroupedNodes$1$1$1.invokeSuspend(WorkNodeCodec.kt:332)
[2026-03-04T15:28:37.677Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$writeGroupedNodes$1$1$1.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$writeGroupedNodes$1$1$1.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2$1$1.invokeSuspend(WorkNodeCodec.kt:400)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2$1$1.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2$1$1.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.graph.RunningKt$runWriteOperation$1.invokeSuspend(Running.kt:43)
[2026-03-04T15:28:37.678Z] at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
[2026-03-04T15:28:37.678Z] at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.graph.RunningKt.runToCompletion(Running.kt:58)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.graph.RunningKt.runWriteOperation(Running.kt:42)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2$1.accept(WorkNodeCodec.kt:399)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2$1.accept(WorkNodeCodec.kt:398)
[2026-03-04T15:28:37.678Z] at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:443)
[2026-03-04T15:28:37.678Z] at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$fromMutableState$1(DefaultProjectStateRegistry.java:450)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.work.DefaultWorkerLeaseService.lambda$withLocksAcquired$0(DefaultWorkerLeaseService.java:275)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.work.ResourceLockStatistics$1.measure(ResourceLockStatistics.java:43)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.work.DefaultWorkerLeaseService.withLocksAcquired(DefaultWorkerLeaseService.java:273)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.work.DefaultWorkerLeaseService.lambda$withReplacedLocks$3(DefaultWorkerLeaseService.java:371)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLocks(DefaultWorkerLeaseService.java:343)
[2026-03-04T15:28:37.678Z] at org.gradle.internal.work.DefaultWorkerLeaseService.withReplacedLocks(DefaultWorkerLeaseService.java:370)
[2026-03-04T15:28:37.678Z] at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.runWithModelLock(DefaultProjectStateRegistry.java:471)
[2026-03-04T15:28:37.678Z] at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:450)
[2026-03-04T15:28:37.679Z] at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:442)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2.invokeSuspend(WorkNodeCodec.kt:398)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$safeRunnerFor$2.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$writeGroupedNodes$1.invokeSuspend(WorkNodeCodec.kt:331)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$writeGroupedNodes$1.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec$writeGroupedNodes$1.invoke(WorkNodeCodec.kt)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.graph.RunningKt$runWriteOperation$1.invokeSuspend(Running.kt:43)
[2026-03-04T15:28:37.679Z] at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
[2026-03-04T15:28:37.679Z] at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.graph.RunningKt.runToCompletion(Running.kt:58)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.graph.RunningKt.runWriteOperation(Running.kt:42)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec.writeGroupedNodes(WorkNodeCodec.kt:327)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodec.writeNodeBatchesInParallel$lambda$1$0$0(WorkNodeCodec.kt:248)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.serialize.codecs.core.WorkNodeCodecKt$asBuildOperation$1.run(WorkNodeCodec.kt:640)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:67)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:60)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:167)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:60)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$executeInParallel$0(DefaultBuildOperationExecutor.java:114)
[2026-03-04T15:28:37.679Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.runOperation(DefaultBuildOperationQueue.java:305)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.doRunBatch(DefaultBuildOperationQueue.java:286)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.executePendingWork(DefaultBuildOperationQueue.java:257)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.lambda$runBatch$0(DefaultBuildOperationQueue.java:244)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.work.DefaultWorkerLeaseService.lambda$withLocksAcquired$0(DefaultWorkerLeaseService.java:275)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.work.ResourceLockStatistics$1.measure(ResourceLockStatistics.java:43)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.work.DefaultWorkerLeaseService.withLocksAcquired(DefaultWorkerLeaseService.java:273)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:265)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:128)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.runBatch(DefaultBuildOperationQueue.java:244)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.runOperations(DefaultBuildOperationQueue.java:215)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:84)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.operations.DefaultBuildOperationQueue$WorkerRunnable.run(DefaultBuildOperationQueue.java:208)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[2026-03-04T15:28:37.680Z] at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
[2026-03-04T15:28:37.680Z]
[2026-03-04T15:28:37.680Z]
[2026-03-04T15:28:37.680Z] BUILD FAILED in 11s
[2026-03-04T15:28:37.680Z] 4 actionable tasks: 4 up-to-date
Welcome to the community @Barry_Irvine and thanks both of you for this report!
We did release SonarScanner for Gradle today, and you’ve been very quick on the uptake here - we haven’t even had a chance to do the announcement yet.
Unfortunately, we (still) didn’t intend this version to support Android Gradle Plugin 9+. That is in the backlog. We’re not ignoring AGP9+ users. And we’ve been struggling with some infrastructure stuff that’s gotten in the way of fixing the AGP problem. Now the infrastructure is fixed, and we’re starting to work on the backlog. We hope to get y’all a working version in late April. Thank you for being patient, and we’re sorry we have to ask you to be.
I originally reported this issue on January 16th, and it’s quite surprising to hear now that support for AGP 9 in the Sonar Gradle plugin is only planned for the end of April.
This problem effectively blocks projects that have already moved to AGP 9, so from a user perspective it feels like a fairly critical compatibility issue. Because of that, I would have expected it to be treated with higher priority.
Waiting until the end of April puts teams in a difficult position, especially when they want to keep their build stack up to date. It would be greatly appreciated if this could be prioritized and addressed sooner, or if there is at least a temporary workaround that you could recommend.
I think we (Android devs) are aware that SonarQube does not yet fully support Android Gradle Plugin 9. I think there are many plugins and 3rd party dependencies that are working on adding support for it at this point.
But until now we were able to update to AGP9 and opt-out of some of the behavior changes, to make AGP9 behave like APG8. So people could still use the latest version. Now with AGP9.1 the SonarQube plugin runs into a RuntimeException we can not control by any flags. Therefore I would really like to ask the Sonar team to provide an ad-hoc hotfix (just add try-catch around this method call) to allow devs to use the latest AGP version.
Waiting for end of April is not acceptable. We should not plan and build our projects around you priority list and roadmap but vice-versa. Also I seriously doubt that the first release of your plugin with AGP9 support will work with all the projects out there. So we will probably have to wait way longer.