找不到符号类“生成”为匕首2

编程入门 行业动态 更新时间:2024-10-18 08:37:10
本文介绍了找不到符号类“生成”为匕首2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚开始使用 Dagger 2 进行依赖注入。当我启动模块,组件并尝试构建我的应用程序时, gradle 抛出错误

I just started doing dependency injection using Dagger 2. When I spun up my modules, components and tried to build my application, gradle threw the error

错误:(4,24)错误:找不到符号类生成

我挖到它并发现错误是在其中一个类 Dagger 生成 DI 。缺少的特定类是 javax.annotation.Generated ,抛出错误的行是一行代表 Dagger 生成的类为 @Generated(dagger.internal.codegen.ComponentProcessor)

I dug into it and found that the error is in one of the classes Dagger generates to do DI. The particular class that's missing was javax.annotation.Generated and the line throwing the error is the line that anntotates a Dagger generated class as @Generated("dagger.internal.codegen.ComponentProcessor")

这个问题有助于找到解决方案,即添加 javax 通过将行 compile'org.glassfish:javax.annotation:10.0-b28'添加到我的gradle构建文件中作为依赖包。这导致了一个成功的构建。

This question helped in finding the solution which is to add the javax package as a dependency by adding the line compile 'org.glassfish:javax.annotation:10.0-b28' to my gradle build file. This led to a successful build.

我的问题是,为什么没有添加为 Dagger的传递依赖或者为什么没有其他人遇到这个特殊问题(我假设是这样,因为我在这里找不到任何关于这个的问题?

My question is, why is that not added as a transitive dependency for Dagger or why hasn't anyone else faced this particular issue (I assume so, since I couldn't find any question here regarding this?

推荐答案

阅读本文以获取更多信息: github/google/dagger/issues/ 95

Read this for more info: github/google/dagger/issues/95

基本上,解决方案是做你已经完成的工作,包括glassfish javax注释库。

Basically, the solution is to do what you've already done which is include the glassfish javax annotation library.

更多推荐

找不到符号类“生成”为匕首2

本文发布于:2023-10-31 04:32:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545016.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   匕首   符号

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!