damianpetla / kotlin-dagger-example

Example of Android project showing integration with Kotlin and Dagger 2
535 stars 57 forks source link

Can't inject Kotlin classes #6

Closed danieldisu closed 8 years ago

danieldisu commented 8 years ago

Hello,

I've cloned your project and made some changes to see if I can introduce Dagger in my project, I cannot seem to find the way to inject Kotlin classes, and this example doesn't show that. I just inject a Java class..

The dagger generated classes doesn't seem to be able to find the Kotlin class and failed to compile..

I have this code in my activity:

@Inject
 lateinit var presenter: LoginPresenter

And this is the LoginPresenter:

class LoginPresenter : BasePresenter<LoginView> {

    @Inject constructor() {

    }

   ....
}

and it throws the following error

kotlindaggerfailed

any ideas?

danieldisu commented 8 years ago

Ok, I found it, it was a problem with the package in my LoginPresenter class...