Closed barriosnahuel closed 4 years ago
We can close it, I added more info at https://issuetracker.google.com/issues/137253405#comment3 (if you need, I can add a new issue for the spotbugs failure)
To sum up my research into this…
The issue with :my_anroid_dynamic_feature_module:processDebugAndroidTestResources
is actually a bug in AGP for dynamic modules. It fails to compile androidTest
for that module by not being able to resolve resources from an aar dependency that are actually there. SCA has nothing to do with it, other than simply forcing the task to run, as we need compiled sourced for PMD / Spotbugs analysis. The same issue would arise if you were to simply write an instrumentation test for that module even without SCA. I'd therefore recommend you report that back to https://b.android.com/
As for the issue with no classes for Spotbugs analysis… the problem relies on your project having a non-emtpy Java sourceset, that contains no Java classes (the failing module contains only Kotlin classes in the Java sourceset). As SCA doesn't yet support Kotlin, the Kotlin classes are not being present in the analysis, but as there are files, Spotbugs still believes there is something to analyze and fails…
I do have in backlog to fully support Kotlin in an upcoming 3.x release. In the meantime, you can use the following workaround:
tasks.matching { it.name =~ /^spotbugs.+/ }.configureEach {
it.onlyIf { !it.classes.empty }
}
Hi!
I'm having two issues after upgrading to SCA
v3.0.0
.First one is related to PMD, second one to Spotbugs.
Context
I was using
v2.6.12
fine in the given context:'com.android.tools.build:gradle:3.6.2'
Note: SCA
v2.6.12
comes with PMDv6.20.0
Error
PMD runs ok in all modules but on the dynamic feature module, I'm getting the following result:
What I've tried
'com.android.tools.build:gradle:3.6.2'
tov3.6.3
==> same errorv6.3
==> same errorv3.0.0
downgrading to PMDv6.20.0
==> same errorv5.2.1
(with'com.android.tools.build:gradle:3.4.1'
) ==> It works! 🤔Why I tried downgrading to
v5.2.1
? After upgrading to SCAv3.0.0
, when running:I'm getting the following error:
No classes configured for SpotBugs analysis.
which is extremely similar to https://github.com/spotbugs/spotbugs-gradle-plugin/issues/23.
But in this new context with Gradle
v5.2.1
when running spotbugs I fall into https://github.com/spotbugs/spotbugs-gradle-plugin/issues/90.Since all was working ok before upgrading and even after upgrading but using the previous version of PMD, I think it's a bug on SCA itself (perhaps on the workaround I assume you're doing to make Spotbugs work with Android projects? Should I file a new issue for this Spotbugs behaviour?
I can share a branch to try on..