Butterknife: annotationProcessor dont work, but apt does

Created on 19 Dec 2016  Â·  10Comments  Â·  Source: JakeWharton/butterknife

In your README you say this:
'annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

but with annotationProcessor It doesn't work, only if the word is replaced wtih apt.

I think you should make it clear in the documentation

Most helpful comment

Same here: with annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' the binding is failing, while when using the apt plugin everything was fine.

The problem is that findBindingConstructorForClass() when Class<?> bindingClass = Class.forName(clsName + "_ViewBinding"); throws a ClassNotFoundException.

I'm using the following configuration:
classpath 'com.android.tools.build:gradle:2.2.3'
buildToolsVersion "25.0.2"
compileSdkVersion 25 & targetSdkVersion 25
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 - but no Jack enabled

The annotationProcessor 'com.google.auto.value:auto-value:1.2-rc1' seems to work fine with the above configuration.

Let me know if I can help with more details.

All 10 comments

That is incorrect. apt is the old, deprecated Gradle plugin which is now built-in modern versions of the Android gradle plugin.

But I do have the latest version of both gradle and Butterknife and it didn't work with annotationProcessor, but only with apt. I don't know exactly why

Same issue here.

I am also facing with same problem with
com.android.tools.build:gradle:2.2.3

I guess we are many more with the same problem

@JakeWharton
AnnotationProcessorworks great but if we are using libraries like Schematic which depends upon apt plugin then this creates issue. Sadly some projects depend upon apt which can only be changed by upstream developers only.
It would be helpful if there is a section somehwere in the README stating that if used in a project which uses apt, annotationprocessor should be replaced with apt.

No. Those projects need updated, not this one.

On Fri, Dec 30, 2016 at 12:11 PM Jatin Dhankhar notifications@github.com
wrote:

@JakeWharton https://github.com/JakeWharton
AnnotationProcessorworks great but if we are using libraries like
Schematic which depends upon apt plugin then this creates issue. Sadly some
projects depend upon apt which can only be changed by upstream developers
only.
It would be helpful if there is a section somehwere in the README stating
that if used in a project which uses apt, annotationprocessor should be
replaced with apt.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/JakeWharton/butterknife/issues/828#issuecomment-269796397,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEVtaN81dUcbzvsv1JS1rOic3eoLBks5rNTsxgaJpZM4LRG2x
.

Okay
Thanks, I will ask developer of Schematic to migrate to annotationProcessor but a warning in the readme would save many trips to Google.

I did not use any other libraries than butternknife

Same here: with annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' the binding is failing, while when using the apt plugin everything was fine.

The problem is that findBindingConstructorForClass() when Class<?> bindingClass = Class.forName(clsName + "_ViewBinding"); throws a ClassNotFoundException.

I'm using the following configuration:
classpath 'com.android.tools.build:gradle:2.2.3'
buildToolsVersion "25.0.2"
compileSdkVersion 25 & targetSdkVersion 25
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 - but no Jack enabled

The annotationProcessor 'com.google.auto.value:auto-value:1.2-rc1' seems to work fine with the above configuration.

Let me know if I can help with more details.

Was this page helpful?
0 / 5 - 0 ratings