最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - How can I disable adding of the comment containing command used to generate a Java class? - Stack Overflow

programmeradmin2浏览0评论

I am facing issues with the newest Android build tools. Something has changed and suddenly in generated classes (directory marked as "generated" in Android Studio) an additional comment on top of the file is being added, which contains the command used to generate the class. It started causing issues, because suddenly builds started failing because of "Illegal unicode escape", which is somewhat understandable, because my build variant name starts with "u", so the command used to generate the class contains something like \uvariantName which of course is an illegal escape because of the \u part.

For now I have decided to use buildToolsVersion '34.0.0' in "infected" modules, which is a fine workaround. So right now I am thinking if there is a way to disable the addition of the command in the comment to truly solve the problem? I mean, thinking seriously and all I can't be the only one affected by such change?

I tried looking into what generates those classes but I lack knowledge on how to actually find that information (even asked GPT about it). The project I encounter this problem in is pretty robust, so I didn't actually look through all configs, etc. I just need a nudge in the right direction, if someone is able to tell me where those classes might come from then I will look into how to configure that thing and check the changelog myself.

I am facing issues with the newest Android build tools. Something has changed and suddenly in generated classes (directory marked as "generated" in Android Studio) an additional comment on top of the file is being added, which contains the command used to generate the class. It started causing issues, because suddenly builds started failing because of "Illegal unicode escape", which is somewhat understandable, because my build variant name starts with "u", so the command used to generate the class contains something like \uvariantName which of course is an illegal escape because of the \u part.

For now I have decided to use buildToolsVersion '34.0.0' in "infected" modules, which is a fine workaround. So right now I am thinking if there is a way to disable the addition of the command in the comment to truly solve the problem? I mean, thinking seriously and all I can't be the only one affected by such change?

I tried looking into what generates those classes but I lack knowledge on how to actually find that information (even asked GPT about it). The project I encounter this problem in is pretty robust, so I didn't actually look through all configs, etc. I just need a nudge in the right direction, if someone is able to tell me where those classes might come from then I will look into how to configure that thing and check the changelog myself.

Share Improve this question asked Mar 7 at 13:34 XirateXirate 1093 bronze badges 1
  • You might consider editing your question and providing more details about a specific example. What is an example generated source file that exhibits this behavior? What is the generated source code, in particular the comment that is giving you problems? What is generating that source code? – CommonsWare Commented Mar 7 at 14:25
Add a comment  | 

1 Answer 1

Reset to default 0

gradle.properties

android.aaptOptions.additionalParameters += "--no-version-vectors"
android.aaptOptions.additionalParameters += "--no-version-comments"

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论