0

I am learning how to use Dagger2. I created an example as shown below in the code. the issue I am facing is, the auto generated class by Daggers, the one that should be called "DaggerInterfaceComponent" is never gets created. The below DaggerInterfaceComponent is underscored with red.

Please have a look at the build gradle App posted below.

code:

InterfaceComponent component = DaggerInterfaceComponent.builder().objectValuesModule(new ObjectValuesModule()).build();
    Object injectedObject = component.getObjectValues();

    int returnedInt = injectedObject.getreturnInteger();
    int returnedStr = injectedObject.getReturnString();
    int returnedObj = injectedObject.getReturnObject();

gradle App

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

compile "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"
provided 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'
}
Amrmsmb
  • 1
  • 27
  • 104
  • 226
  • Clear and build project – Amir Mohsenian Aug 11 '18 at 13:28
  • Dagger generates the interface implementation as a part of compilation, and if it encounters any errors, the file is not generated. Thank you for posting your Gradle file and the instantiation, but please also post the source code to your _component interface_, _relevant modules_, and (most important) any _compiler errors_ like the one at the top of [this question](https://stackoverflow.com/q/48380865/1426891) ("HomePresenter cannot be provided..."). – Jeff Bowman Aug 12 '18 at 18:15

0 Answers0