Closed giovanischiar closed 4 months ago
Thanks for the issue!
Hopefully the build scan will be enough, but do you have a minimal reproducer? Those repro steps don't look sufficient to me.
I've got a reproducer, this is a new project created with Android Studio Hedgehog with the only change being that I added this plugin MyApplication.zip
Here's another repro, just uncomment the commented out enabling of DAGP in the root build.gradle.kts: https://github.com/ZacSweers/CatchUp
I've got a reproducer, this is a new project created with Android Studio Hedgehog with the only change being that I added this plugin MyApplication.zip
@gabrielittner I downloaded this zip and ran buildHealth
on it and there were no errors. Is there something I'm missing?
I can still reproduce it when I download the zip and run buildHealth. However after deleting ~/.android/analytics.settings
it doesn't reproduce anymore and as soon as the file is recreated it's happening again. Just the existence of the file seems to be enough, so you should be able to reproduce it by just creating it without content.
how is that file used? I'm not familiar with it. do you have an example with actual content? links to documentation?
I just checked and I already have such a file in my environment. The contents of it are
{"userId":"73484633-8bc3-4f83-9fcb-edcf4ec64b4e","hasOptedIn":false,"debugDisablePublishing":false,"saltValue":0,"saltSkew":-1}
Mine looks the same and it's created/updated when you toggle "send usage statistics to Google" in Android Studio, other than that I don't know more about it. I was just thinking about it since the issue is analytics related. For me it happens regadless of whether "hasOptedIn"
is true or false but maybe changing it true will help reproducing it?
I changed the value to true and reran buildHealth (with --rerun-tasks
) and it worked fine :shrug:
Have you tried with rerun-tasks?
--rerun-tasks
didn't help. I tried aroudn a bit more and it looks like you need to kill the daemon after changing hasOptedIn or generally use --no-daemon
for the change to take effect.
--no-daemon
did it 🤔
Ok, so, to reproduce this error, it looks like at least two things need to be true:
hasOptedIn
to true--no-daemon
==> ./gradlew :app:explodeXmlSourceDebugTest --no-daemon
I note that this doesn't fail with the :app:explodeXmlSourceDebug
task (for the main source set), nor does it fail for the :app:explodeXmlSourceDebugAndroidTest
task (the androidTest source set). It's only failing for the test
source set. I think this might relate to the Android unit tests not having resources enabled, and DAGP not handling that properly.
Further confirmation, the success cases all have tasks like :app:generateDebugAndroidTestResValues
and :app:generateDebugResValues
. There however is no task named :app:generateDebugTestResValues
. (type: com.android.build.gradle.tasks.GenerateResValues
.)
I can eliminate the error by basically commenting out this method body for android unit tests. Given the whole chain is nullable, it is bizarre to me that this happens. It looks like an AGP bug.
override fun getAndroidRes(): Provider<Iterable<File>> {
// return project.provider { emptyList() }
return sources.res?.all
?.map { layers -> layers.flatten() }
?.map { directories ->
directories.map { directory -> directory.asFileTree.matching(Language.filterOf(Language.XML)) }
}
?.map { trees -> trees.flatten() }
?: project.provider { emptyList() }
}
Build scan link https://scans.gradle.com/s/4qwwjyf5chvkk
Plugin version latest snapshot "+"
Gradle version 8.2
JDK version 17
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version 1.9.21
(Optional) Android Gradle Plugin (AGP) version 8.2.1
Describe the bug When I add the
id("com.autonomousapps.dependency-analysis") version "+"
to root build.gradle and run./gradlew projectHealth
I got this error Could not determine the dependencies of task ':app:synthesizeProjectViewDebugTest'.To Reproduce Steps to reproduce the behavior:
id("com.autonomousapps.dependency-analysis") version "+"
to root build.gradle./gradlew projectHealth
Expected behavior The default output for projectHealth