英文:
Annotation process feature not working since androidX upgrade
问题
我有一个完美运行的项目。
迁移到了androidX,之后我发现我的注解处理器不工作了。
已经完成了链接中提到的所有包更改:https://developer.android.com/jetpack/androidx/migrate,甚至使用了迁移工具。
按照这个帖子中的步骤进行操作:https://stackoverflow.com/questions/45826037/annotation-processor-not-working-no-files-are-created
将上述内容引用如下:
我尝试了常见的解决方法:
- 从Android Studio的“最近”中移除我的项目
- 清除缓存并重新启动Android Studio
- 将我的项目重新导入到Android Studio中(确保在之前启用了注解处理)
- 添加 > apply plugin: 'kotlin-android'
按照这个帖子中提到的步骤进行操作:https://stackoverflow.com/questions/56289830/enable-annotation-processing-for-existing-projects-android-studio-3-3
寻找了关于注解处理的示例,但它们都是在升级到androidX之前的:
- https://medium.com/@robhor/annotation-processing-for-android-b7eda1a41051
- https://medium.com/@aitorvs/annotation-processing-in-android-studio-7042ccb83024
- https://blog.mindorks.com/android-annotation-processing-tutorial-part-1-a-practical-approach
我确实注意到注解处理器的工作方式略有不同,我正在使用"kapt project(':xx')",而不是"annotationProcessor project(path: ':xxx')"。
有什么建议吗?尽管有很多相关内容,但我觉得这个问题是有效的,因为在AndroidX和注解处理方面,除了这个问题https://stackoverflow.com/questions/52537975/migrate-annotation-processor-to-androidx,没有找到其他具体的内容。而且那个问题并没有解答我的问题,因为我已经完成了包的更改。
英文:
I have a project working perfectly.
Migrated to androidX and after that I see my annotation processor are not working.
Already done all the package changes mentioned in this link: https://developer.android.com/jetpack/androidx/migrate even used the migration tool.
Followed the steps mentioned by this guy :https://stackoverflow.com/questions/45826037/annotation-processor-not-working-no-files-are-created
Sanity checks will qoute the above:
I tried the common solutions:
- remove my project from Android Studio recents
- invalidate cache and restart android studio
- import my project again into android studio (made sure that annotation processing is enabled before)
- Added > apply plugin: 'kotlin-android'
Followed the steps this guy mentioned: https://stackoverflow.com/questions/56289830/enable-annotation-processing-for-existing-projects-android-studio-3-3
Looked for examples on annotation processing but all of them are before the androidX upgrade:
- https://medium.com/@robhor/annotation-processing-for-android-b7eda1a41051
- https://medium.com/@aitorvs/annotation-processing-in-android-studio-7042ccb83024
- https://blog.mindorks.com/android-annotation-processing-tutorial-part-1-a-practical-approach
I did notice that the way annotation processors work are slightly different I am using "kapt project(':xx')" instead of "annotationProcessor project(path: ':xxx')"
Any advise I do feel this question is valid even though there are a lot of content out there cannot find anything specific to AndroidX and Annotation processor except this: https://stackoverflow.com/questions/52537975/migrate-annotation-processor-to-androidx and that does not answer the question because I already done the package changes?
答案1
得分: 0
似乎在重新执行整个过程后,我需要将Gradle升级到更高的版本,在升级Gradle到6.1.1版本后,一切都运行得很顺利。
英文:
Seems like I needed to upgrade Gradle to higher version after redoing the entire process upgraded Gradle to version 6.1.1 and worked like a charm.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论