0

I´m making an android app that uses dagger + butterknife + recycleviews + retrofit.

It all compiles and work wel until I add the butter knife dependencies (the ones related to the apt) in the gradle that after I sync, my Dagger Component is not found even if I clean and rebuild again. But if I removed my butterknife dependencies (the ones related to the apt), sync and build, my Dagger component is found.

Here is my gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

and my app gradle:

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

compile 'com.google.dagger:dagger:2.7'
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'

compile 'com.android.support:design:24.0.0-beta1'
compile 'com.android.support:support-v4:24.0.0-beta1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'io.reactivex:rxjava:1.1.6'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'

My dagger component:

DaggerMyComponent.builder().
        myRetroModule(new MyRetroModule("581e710d3e0000da02c08e10")).
        build().
        inject(this); // instance

And without the apt dependencies, butterknife doesn´t work What do I need to do in order to be able to use butterknife + dagger together?

Thanks in advance.

linker85
  • 1,601
  • 5
  • 26
  • 44

1 Answers1

1

I was doing some testing and I changed

compile 'com.google.dagger:dagger-compiler:2.7'

to

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

Sync and that worked.

linker85
  • 1,601
  • 5
  • 26
  • 44