In Progress
Status Update
Comments
jb...@google.com <jb...@google.com>
hu...@google.com <hu...@google.com>
mi...@mikehardy.net <mi...@mikehardy.net> #2
I tried adding screenshotTestImplementation(libs.androidx.window)
but it didn't fix it.
ts...@gmail.com <ts...@gmail.com> #3
This is likely a duplicate of libs.androidx.window
dependency to implementation
to see if it works?
ts...@gmail.com <ts...@gmail.com> #4
Any update on this? Still stuck on AGP 8.2.2 because of this issue!
Description
I have a multi module project, an application module
app
and a library moduletestShared
. ThetestShared
library has common test code for running unit and instrumentation tests.I've defined my debug buildTypes as:
And referenced the
testShared
module in app's build.gradle.kts like this so that the unit and instrumentation tests inapp
can both use the shared code intestShared
:When
testDebugUnitTest
is run, I see atestDebugUnitTest.exec
file created. When I runconnectedDebugAndroidTest
, I do see acoverage.ec
file also get created. When I generate a code coverage report using Jacoco, I'll see coverage from the unit tests, but not the instrumentation tests. Examining thecoverage.ec
file notes there is no references to any of the source files, so the issue is not in the generating the report, but in the coverage.ec generated while running the instrumentation tests.Investigation
Prior to AGP 8.3, code coverage did work (most recently tested with AGP 8.2.2), with a caveat in in AGP 8+, the following needs to be added to
build.gradle.kts
:which works around a https://issuetracker.google.com/issues/178015739#comment6 .
Caused by: java.lang.IllegalStateException: Cannot process instrumented class <class>. Please supply original non-instrumented classes.
issue that is documented inThis workaround must be removed with AGP 8.3, as
testDebugUnitTest
will generate no unit test code coverage.In AGP 8.3+, I found that if I removed the
androidTestImplementation(project(...))
reference, coverage would work fine. This isn't an option, as the whole point of the library is to provide common code.Steps to Reproduce:
KotlinDslTestApp.zip
project attached to this issue.gradlew clean testDebugUnitTest
gradlew connectedDebugAndroidTest
gradlew testDebugUnitTestCoverage
and examine the coverage inbuild/reports/coverage/html/com.foo.kotlindsltestapp/index.html
.Attached the debug output of
connectedDebugAndroidTest
and a samplecoverage.ec
from this run.IMPORTANT: Please readhttps://developer.android.com/studio/report-bugs.html carefully and supply
all required information.
Studio Build: