Elye

@elye.project

Issues faced when setup Dagger 2 on Kotlin

After setup Kotlin (as per this article), I faced several issues, and have them resolve. I’m stating them here as reference to all who encounter the same…

Error: java.lang.NullPointerException (no error message)

Upon first compilation, you’ll see this error keep occuring. Don’t know why it happens. Apparently, you just need to delete and clean your gradle (Build →Clean Project), and recompile, then the error should go away.

Warning: Dagger 2.2 component builder module method deprecated

If you just setup your project with Dagger without actually using any of the injected object, you might see the above warning. Don’t worry, this is just a feature generated by Dagger to warn you of unused module. Check out the Stack Overflow below to discover how you could confirm that’s indeed the case.

Dagger 2.2 component builder module method deprecated

Warning: the ‘-d’ option with a directory destination is ignored because ‘-module’ is specified

This warning is actually a Kotlin bug. It doesn’t exist in Kotlin version 1.0.5, but was found in 1.1.1 (introduced something in between). However it should be fixed in Kotlin version 1.1.2 as mentioned in the StackOverflow below.

Warning:the '-d' option with a directory destination is ignored because '-module' is specified

That’s all I encountered. If you found more issues, feel free to share with me, an hopefully with the resolution as well. I could shared with others and .

Click “❤” below to share. Thanks! ~Twitter:elye; Facebook:elye

More by Elye

Topics of interest

More Related Stories