ERROR : error.NonExistentClass Kotlin In multi module Dagger project

I’m using Dagger 2 and Kotlin for Android development.
And my project is also a multi-module project.
My settings.gradle file is like this

include :app
include :lib

I’m also maintaining the lib module.

In the Dagger Files (for example in the component), I try to get the item from other module. For example:

@Component
interface AppComponent{
    fun getPresenter() : Presenter
}

The Presenter object is defined in lib module. I was working in linux environment and I’m using android studio 3 preview canary 5. The code is working well and I can generate APK.

But then my company wanted me to generate the APK using stable version of Android Studio.

Then I’m using Android Studio 2.3.3

When I’m compiling the Android Project, then I encountered this error

error: error.NonExistentClass

The error appears when

:app:kaptDebugKotlin 

is performed and caused by the dagger class cannot found the class defined in the other project. What can I do for workaround this? Sorry for my bad English.

2 Likes

Having the same problem. It always happens due to basic problems in dagger related files and it’s becoming a debugging nightmare for me, since neither Android Studio or the gradle log help in any way to find it.

1 Like