Status Update
Comments
ac...@google.com <ac...@google.com>
je...@google.com <je...@google.com> #2
This is working as intended, Gradle will generate kotlin accessors for your dependencies so you can access them using a symbol in your build.gradle.kts.
Those accessors must have a name that is compliant with the JVM specification and indeed has language specific reserved keywords.
I am closing this because :
- working as intended, don't use Java/Kotlin keywords
- This is a Gradle issue so if you still feel something is incorrect, file it at
https://github.com/gradle/gradle/issues
xo...@google.com <xo...@google.com>
xo...@google.com <xo...@google.com> #3
Thanks for the report. I've modified the heuristics used to choose a name in the version catalog to modify the chosen name if it contains groups that collide with reserved words; this change should be available in Android Studio from Meerkat Canary 6.
an...@google.com <an...@google.com> #4
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Meerkat | 2024.3.1 Canary 6
- Android Gradle Plugin 8.9.0-alpha06
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
BACKGROUND
I am migrating the versioning for a dependency (e.g. "implementation "foo.bar:baz:1.0.0") in my build.gradle to my libs.versions.toml file. Android Studio provides a context suggestion (can be accessed by right-clicking on the dependency's string), "Replace with new library catalog suggestion for baz", and selecting the context suggestion migrates the dependency to the version catalog so that my build.gradle now contains "implementation libs.baz".
PROBLEM
In the case of migrating "implementation androidx.compose.material3:material3-window-size-class" to the version catalog, a gradle-sync error occurs because the refactored dependency in my build.gradle was set to "implementation libs.androidx.material3.window.size.class", and
class
seems to be a reserved keyword, causing the following error (I am pasting the top section of the error):Refactoring the library name to "libs-androidx-material3-window-size" fixes the error.
Attach log files from Android Studio 2A. In the IDE, select the Help..Collect Logs and Diagnostic Data menu option. 2B. Create a diagnostic report and save it to your local computer. 2C. Attach the report to this bug using the Add attachments button.
If you know what they are, write the steps to reproduce:
3A. Create a libs.versions.toml file for the project and set up the version catalog file by adding "[versions]", "[libraries]", "[plugins]" on separate lines.
3B. Add "implementation androidx.compose.material3:material3-window-size-class" to the app build.gradle file.
3C. Open the context suggestions for the provided dependency by right-clicking on the string and clicking "Replace with new library catalog declaration for androidx-material3-window-size-class".
3D. Perform a gradle sync and the provided error will occur.
In addition to logs, please attach a screenshot or recording that illustrates the problem.
For more information on how to get your bug routed quickly, seehttps://developer.android.com/studio/report-bugs.html
Build: AI-233.14808.21.2331.11926650, 202406041530
AI-233.14808.21.2331.11926650, JRE 17.0.10+0-17.0.10b1087.21-11572160x64 JetBrains s.r.o., OS Mac OS X(aarch64) v14.6.1, screens 2560.0x1440.0
AS: Jellyfish | 2023.3.1 Patch 2 Kotlin plugin: 233.14808.21.2331.11926650-AS Android Gradle Plugin: 7.2.2 Gradle: 7.4 Gradle JDK: JetBrains Runtime version 17.0.10 NDK: from local.properties: (not specified), latest from SDK: (not found) CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found) Source: send_feedback_icon