无法解析Android中的匕首组件的符号 [英] Can not resolve symbol for dagger component in android

查看:58
本文介绍了无法解析Android中的匕首组件的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Dagger2添加到Android Studio中的项目中。

I'm trying to add Dagger2 to my project in Android Studio.

这是我的依赖项。

compile 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
provided 'javax.annotation:jsr250-api:1.0'

我正在关注此示例。

https://guides.codepath.com/android/Dependency-Injection-with-Dagger-2#advantages

我收到此错误。

无法解析符号DaggerNetComponent

Can not resolve symbol DaggerNetComponent

我尝试更改谷歌搜索后发现的依赖关系和其他解决方案。

I tried changing dependencies and other solution found after googling. but no luck.

有人可以帮我吗?

推荐答案

DaggerNetComponent在编译后生成。您应该在编译中启用注释处理以生成该文件。此链接具有详细信息。

The DaggerNetComponent is generated after compilation. You should enable annotation processing in compilation to generate that file. This link has the details.

这些生成的文件应添加到项目的源路径中,以得到认可。

These generated file should be added to the source path of the project to get recognized.

这篇关于无法解析Android中的匕首组件的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆