1

I have project that was initially started with Java(contains dagger and moxy frameworks).

I have added room dependency and I have create all room components in kotlin so as dependency I using:

implementation "androidx.room:room-runtime:2.2.6"

kapt "androidx.room:room-compiler:2.2.6"

When I adding apply plugin: 'kotlin-kapt' I have dagger error:

cannot find symbol DaggerAppComponent;

When I try to add kapt "com.google.dagger:dagger-compiler:$dagger" the error disappear but I got new error, the moxy(MVP framework)@InjectPresenter not working in runtime(presenters is null)

moxy initial dependencies

implementation "com.github.moxy-community:moxy:2.2.1"
implementation "com.github.moxy-community:moxy-app-compat:2.2.1"
annotationProcessor "com.github.moxy-community:moxy-compiler:2.2.1"

dagger initial dependencies

annotationProcessor "com.google.dagger:dagger-compiler:$dagger"
testImplementation "com.google.dagger:dagger:$dagger"
testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger"
androidTestImplementation "com.google.dagger:dagger:$dagger"
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger"
implementation "com.google.dagger:dagger:$dagger"

Why when I adding apply plugin: 'kotlin-kapt' dagger stops compile?

Pavel Poley
  • 5,307
  • 4
  • 35
  • 66

1 Answers1

1

Hi maybe you have a incompatibility problem with dependencies. I'm using room with this dependencies:

//ROOM dependencies
implementation "androidx.room:room-runtime:2.3.0-rc01"
kapt "androidx.room:room-compiler:2.3.0-rc01"
implementation "androidx.room:room-ktx:2.3.0-rc01"

Important:: Make sure that you have declare the android plugins properly, Is important the order plugin declaration, I've imported like this:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

PD: I'm using dagger-hilt and room in the same project and i'm not problems.

Jose Alvarez
  • 301
  • 2
  • 6