Skip to content Skip to sidebar Skip to footer

Dagger2 Is Not Generating Dagger* Classes

As the title says, Dagger2 is not generating the Dagger* prefixed classes for my Android project. I looked at all other similar posts I could find but nothing helps. I'm trying to

Solution 1:

Your apt dependency should be

apt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"

You're missing the -compiler part of the artifact id.

This link also has some useful information. https://github.com/google/dagger#android-gradle

Solution 2:

I was facing the same problem and spent a lot of time over stack overflow. At last I go through this and able to find solution. Briefly, You have to make some changes in your module level Gradle file. Please remove

apply plugin: 'com.neenbedankt.android-apt'

at the top of the file. And replace

apt 'com.google.dagger:dagger-compiler:2.11'

with

annotationProcessor 'com.google.dagger:dagger-compiler:2.11'

After that rebuild your project and you will be able to import your Dagger prefix classes. Hopw it will help you out.

Post a Comment for "Dagger2 Is Not Generating Dagger* Classes"