Reputation: 147
i'm currently learn dagger2 but i have problem is daggercomponent class not generated and i can't know the reason
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. note i rebuild project
Upvotes: 1
Views: 2033
Reputation: 564
If someone still faced this problem, just use those dependencies below it works for me :
implementation 'com.google.dagger:dagger-android:2.44.2'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.20'
annotationProcessor 'com.google.dagger:dagger-compiler:2.20'
try always to use the latest version of the dagger, use this link to get the latest version: https://github.com/google/dagger/releases
Upvotes: 0
Reputation:
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.
Upvotes: 0
Reputation: 5261
You have to implementation dagger
instead of 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'
Upvotes: 1