Status Update
Comments
ha...@gmail.com <ha...@gmail.com> #2
Maybe a dup of
ml...@google.com <ml...@google.com>
jl...@google.com <jl...@google.com>
am...@google.com <am...@google.com> #3
Android Gradle Plugin: 8.7.1
Could you try the latest canary, AGP 8.8.0-alpha09
?
jg...@google.com <jg...@google.com> #4
I just updated to Android Gradle Plugin: 8.7.2 and the bug is fixed.
ru...@google.com <ru...@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.
ro...@gmail.com <ro...@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).
ro...@gmail.com <ro...@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.
ha...@gmail.com <ha...@gmail.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).
ze...@gmail.com <ze...@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
md...@gmail.com <md...@gmail.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
sa...@gmail.com <sa...@gmail.com> #11 Restricted+
md...@gmail.com <md...@gmail.com> #13
Aha! I see the problem. I always use the "Problems" tool window of the IDE to run lint. When I use "./gradlew lint" I get the same results as you do. Apparently the IDE is running lint wrong, feeding lint mangled code, misinterpreting lint's results, or using cached values from AGP 8.7.2 instead of using 8.8.0-alpha09 values. (But these are just guesses of course.)
ya...@gmail.com <ya...@gmail.com> #14
Apparently the IDE is running lint wrong, feeding lint mangled code, misinterpreting lint's results, or using cached values
The issue is the Kotlin compiler front end; when lint within AGP, we have to bundle and invoke our own copy of the Kotlin compiler front end. But when we run inside the IDE, we directly reuse the one from the Kotlin plugin; that way we don't have to re-analyze your code etc, so it's more performant. But that means that lint running in the IDE and lint running from AGP use potentially different versions of the front end.
an...@google.com <an...@google.com> #15
hobby. Let me know if I can be of any help.
On Tue, Nov 5, 2024 at 10:51 AM <buganizer-system@google.com> wrote:
an...@google.com <an...@google.com> #16
Since CLI-side fix is already there, it's relatively easy(?) to port that to IDE-side, and actually ready; see attached screenshot.
an...@google.com <an...@google.com> #17
The fixes for this issue are now also available in:
- Android Studio Ladybug Feature Drop | 2024.2.2 Canary 2
- Android Gradle Plugin 8.8.0-alpha02
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
I'm trying to use a text with an HTMLhttps://github.com/hardysim/htmlbtest .
<b>
-Tag for a composeText()
. The HTML-text is converted to aSpannable
viaHtmlCompat.fromHtml()
and then to anAnnotatedString
which applies a boldSpanStyle
. See the example project:This works fine in the actual app as well as in the compose preview in "Android Studio Dolphin | 2021.3.1 Patch 1" using AGP
7.3.1
. But it stops working when using "Android Studio Electric Eel | 2022.1.1 RC 1". I get the following error for the preview:This is also a problem when using paparazzi to generate snapshot images. The newer paparazzi 1.2 (snapshot version,
1.2.0-20221214.164218-18
to be exact) seems to bring AGP7.4.0-rc01
with it and with AGP maybe a new layoutlib version?. As soon as I use the new paparazzi version, it overrides my locally defined AGP version and the snapshot-generation fails with the same error I get for the preview in Android Studio.Other tags like
<i>
or<u>
are still working fine. Maybe it's related toHtml.handleEndTag()
which adds afontWeightAdjustment
to theSpanStyle
for<b>
- and<strong
>-Tags but that's as far as I got investigating.