I try to upgrade our Android project to Gradle 9.1...
# community-support
p
I try to upgrade our Android project to Gradle 9.1 and came across this issue: https://github.com/gradle/gradle/issues/33619 - all unit tests fail. The suggested workarounds, i.e.
isIncludeAndroidResources = false
and
failOnNoDiscoveredTests = false
do not seem to work, I still get the same error
Copy code
There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.
Upgrading AGP to an alpha 9.x is no option for us atm. Did anyone solve this problem?
1
failOnNoDiscoveredTests=false
works when applied for a single module, I might do something wrong when trying to apply it to all modules via root build.gradle. Anyways, this just ignores the error and tests are not executed, so this is not an option.
Copy code
android {
    testOptions {
        unitTests {
            isIncludeAndroidResources = false
        }
    }
}
doesn't seem to make any difference.
v
If you do have tests, that is not your issue and thus the workaround does not help or course. That issue is, that you do not have tests but this failure occurs due to AGP doing misconfiguration. If you do have tests and get that error, then it does exactly what it is supposed to do, notifying you that you have test sources not no tests were executed, most probably because something is misconfigured
Btw. regarding "I might do something wrong when trying to apply it to all modules via root build.gradle", even trying to that is discouraged bad practice for any configuration. ;-)
😅 1
p
Oh got it 💡 let me check what's going on
Found one module it is working in and compared the differences: It was the missing
de.mannodermaus.android-junit5
plugin. Interesting, that this only kicks in when upgrading Gradle, no problem before. Thank you for clarifying this topic Björn! 🙂
👌 1
v
Before you probably did not get tests executed in that module and just got a deprecation warning by Gradle. What changed in Gradle 9 was, that it made an error to find exactly such misconfigurations. 🙂
❤️ 1