[英]Dagger 2 Component class not generated
i'm currently learn dagger2 but i have problem is daggercomponent class not generated and i can't know the reason我目前正在学习 dagger2 但我有问题是 daggercomponent class 没有生成,我不知道原因
implementation 'com.google.dagger:dagger-android:2.27'
implementation 'com.google.dagger:dagger-android-support:2.27'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.27'
public class Nugets {
@Inject
public Nugets() {
}
}
public class Water {
@Inject
public Water() {
}
}
public class Coffee {
Nugets nugets;
Water water;
@Inject
public Coffee(Nugets nugets, Water water) {
this.nugets = nugets;
this.water = water;
}
}
@Component
public interface CoffeeComponent {
Coffee getCoffee();
}
when i tried to to find DaggerCoffeeComponent class i didn't find it.当我试图找到 DaggerCoffeeComponent class 时,我没有找到它。 note i rebuild project注意我重建项目
You have to implementation dagger
instead of dagger-android
.你必须实现dagger
而不是dagger-android
。 Don't forget to make project or rebuild不要忘记制作项目或重建
implementation 'com.google.dagger:dagger:2.27'
annotationProcessor 'com.google.dagger:dagger-compiler:2.27'
Question you asked i encountered many times, And the lucky thing is i know how to solve it.你问的问题我遇到过很多次,幸运的是我知道如何解决它。 here are simple methods you can follow to solve it.以下是您可以遵循的简单方法来解决它。
Here are some quick methods,you can try to solve it.这里有一些快速的方法,你可以尝试解决它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.