Status Update
Comments
dy...@google.com <dy...@google.com>
ma...@gmail.com <ma...@gmail.com> #3
Android Gradle Plugin: 8.7.1
Could you try the latest canary, AGP 8.8.0-alpha09
?
ma...@gmail.com <ma...@gmail.com> #4
I just updated to Android Gradle Plugin: 8.7.2 and the bug is fixed.
aa...@google.com <aa...@google.com> #5
I spoke too soon. The bug appears gone when I use a different computer, but that is only because the lint check is disabled on it. The computer with the false positive is a new cloning of my github project which apparently has the lint check enabled. The AGP 8.8.0-alpha09 plugin will not work on ladybug, and I'm too busy to switch to a canary build of android studio just to fix a false positive lint check, sorry.
ma...@gmail.com <ma...@gmail.com> #6
I just tried running lint on two more of my computers, one which also has a fresh clone of the github project, and one which has an "ancient" (but up to date) clone of the project -- the two computers have very different Settings -> Editor -> Inspections choices. The old clones do not have this lint check anywhere in their choices, whereas new clones do. Very odd indeed. (I have .idea/ in my .gitignore BTW).
aa...@google.com <aa...@google.com>
ma...@gmail.com <ma...@gmail.com> #7
I understand that it's not trivial to change AGP version; sorry for suggesting that first.
Actually, there is a better way to test: android.experimental.lint.version=8.8.0-alpha09
which will just change the Lint version.
aa...@google.com <aa...@google.com> #8
I decided it was easier to download Android Studio Ladybug Feature Drop | 2024.2.2 Canary 9 than to figure out how to use a different version of lint (a search of stackoverflow suggests this is impossible for what that is worth). Using AGP 8.8.0-alpha09 and gradle-8.10.2-bin.zip on Canary the same error occurs. It looks like it is caused by the K2 compiler mode, because the Inspections options for this lint check does not appear until you enble K2 mode (nor does the false positive error).
ma...@gmail.com <ma...@gmail.com> #9
Thank you for trying the latest canary version of Studio and AGP, I really appreciate that.
I rather confirmed that, with that canary (AGP 8.8.0-alpha09),
I also tried altering problematic produceState
call with conditional assignment to value
, which also works fine. I tried a similar code pattern on compose runtime ProduceStateDetector
and its tests, but no luck.
Then... my next guess is whether it is from an old compose runtime, assuming this might be a dup of
an...@google.com <an...@google.com> #10
The compose runtime is from the androidx-compose-bom = "2024.10.01", which is 1.7.5, which is the latest stable version according to its webpage. The project uses libs.versions.toml and gradle assures me that all the versions are up to date (for what that is worth - sometimes I have to manually update versions). I enclose the libs.versions.toml the project uses. The project is my copy of the "Crane" sample app which I have verbosely commented and try to keep up to date with the latest libraries and APIs. The source code involved is in my github repo in the Crane project:
The file the false positive is in is:
Crane/app/src/main/java/androidx/compose/samples/crane/details/DetailsActivity.kt
Description
Build #AI-241.18034.62.2411.12071903, built on July 11, 2024
Runtime version: 17.0.11+0--11852314 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 3072M
Cores: 16
Registry:
ide.instant.shutdown=false
debugger.watches.in.variables=false
Non-Bundled Plugins:
com.markskelton.one-dark-theme (5.11.0)
com.intellij.marketplace (241.17890.39)
idea.plugin.protoeditor (241.15989.49)
dev.polek.adbwifi (1.2.6)
Docker (241.18034.82)
com.thoughtworks.gauge (241.14494.158)
com.yandex.appmetrica.intellij (0.1.0)
com.github.blarc.gitlab-template-lint-plugin (1.14.1)
Demonstration of the bug in the video.