Skip to content Skip to sidebar Skip to footer

Cannot Find Symbol Class Daggerappcomponent Or Cannot Find Symbol Class Daggeractivitycomponent

I get this error after adding inject on my class then it gives me a compilation error. If I remove @Inject static ApiService mApiService; it's working fine And I'm using 2 Appl

Solution 1:

In my case I tried:

  • invalidating the cache and cleaning the project
  • changing the version of dagger
  • adding -Pandroid.incrementalJavaCompile = false in gradle.properties
  • much more.

The only thing that helped me in my case was to open the console "build", click on "Toggle View" (to the left of the console and below the hammer) and fix the errors that appear on that screen.

Solution 2:

Just to help the people seeking the solution to this problem like me, include below lines in your app's build.gradle module (Replace the existing dagger2 dependencies)

// Dagger 2
implementation "com.google.dagger:dagger-android-support:2.11"
implementation "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"

Solution 3:

If cannot find symbol class DaggerAppComponent Go to: \app\build\generated folder and delete it, than rebuild the project.

Solution 4:

Had this problem. In my case i forgot to put @Singelton above all component classes.

@Singleton@Component(modules = AppModule.class)
public interface AppComponent {
...
}

Solution 5:

In my case, DaggerAppComponent was not generated, since I had included dagger2 dependencies in my submodule. I removed dependencies from there and them in main app module solved the problem.

Post a Comment for "Cannot Find Symbol Class Daggerappcomponent Or Cannot Find Symbol Class Daggeractivitycomponent"