英文:
Android Studio generated files in java folder after upgrading to AGP 8 + Gradle 8.0 + Kotlin 1.8.20
问题
问题确切地如标题所述。Android Studio将Hilt和Glide生成的文件放在普通的java文件夹而不是java(generated)中,导致生成的文件和包与源文件并列。问题仅在1.8 Kotlin版本上发生。在此版本之前的所有版本都正常。我相信问题的根源是kapt,使用annotationProcessor会得到预期的结果。
英文:
The problem is exactly as said in the title. Android Studio is putting Hilt and Glide generated files in regular java folder instead of java(generated) leading to a lot of generated files and packages next to source files.
Problem occurs only on 1.8 Kotlin version. Everything prior to this version works fine. I believe that the root of the problem is kapt, using annotationProcessor leads to the expected result
答案1
得分: 2
Go to the Android Studio Settings and open this path like so:
Build, Execution, Deployment > Build Tools > Gradle
Change the Gradle JDK
to the 11
version if it is 17
and press OK.
Roll back any changes in files that define the JDK version like misc.xml.
Clean your project using Build
menu in the toolbar and Clean Project
item and rebuild your project. It is also a good idea to Invalidate Caches
and restart before build.
英文:
Go to the Android Studio Settings and open this path like so:
Build, Execution, Deployment > Build Tools > Gradle
Change the Gradle JDK
to the 11
version if it is 17
and press OK.
Roll back any changes in files that define the JDK version like misc.xml.
Clean your project using Build
menu in the toolbar and Clean Project
item and rebuild your project. It is also a good idea to Invalidate Caches
and restart before build.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论