Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android studio 3.0 butterknife error #963

Closed
weinierfei opened this issue May 19, 2017 · 62 comments
Closed

Android studio 3.0 butterknife error #963

weinierfei opened this issue May 19, 2017 · 62 comments

Comments

@weinierfei
Copy link

Android studio version: Android studio 3.0 preview
gradle plugin:

        classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'

expection:

Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

I commented out the plugin(classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'), then sync through

@zdongcoding
Copy link

not suppert

@simplysoft
Copy link

simplysoft commented May 20, 2017

We face the same problem, this is probably related to https://developer.android.com/studio/preview/features/new-android-plugin-migration.html#variant_api

@mtdhllf
Copy link

mtdhllf commented May 21, 2017

Error:FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:javaPreCompileDebug'.

Annotation processors must now be declared explicitly. The following dependencies in the compile classpath are found to contain annotation processors. Please add them to the annotationProcessor configuration.
- butterknife-7.0.1.jar
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with the previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

@JakeWharton
Copy link
Owner

JakeWharton commented May 21, 2017 via email

@JvmName
Copy link

JvmName commented May 22, 2017

I'm using the following, with the following error:
root build.gradle:

dependencies {
    classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
    ...
}

lib/build.gradle:

apply plugin: 'com.jakewharton.butterknife'
...
def butterknife = "8.6.0"
implementation "com.jakewharton:butterknife:${butterknife}" //woo new Gradle API!
annotationProcessor "com.jakewharton:butterknife-compiler:${butterknife}"

Stacktrace from gradlew:

Caused by: java.lang.NoSuchMethodError: com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;
        at butterknife.plugin.ButterKnifePlugin$applyPlugin$1.execute(ButterKnifePlugin.kt:27)
        at butterknife.plugin.ButterKnifePlugin$applyPlugin$1.execute(ButterKnifePlugin.kt:15)
        ...

It looks like ButterKnifePlugin.kt #27 is the offending line - it calls variant.outputs.forEach, but the new Android Gradle 3.0 plugin requires variants.outputs.all (source)

I'm not really a Gradle expert - is that really the extent of the change that's necessary?

@JvmName
Copy link

JvmName commented May 22, 2017

I've also tried the 8.6.1-SNAPSHOT - same issue

@preraktrivedi
Copy link

Did anyone find a workaround to this yet?

@Paget96
Copy link

Paget96 commented May 27, 2017

Add
maven {
url 'https://maven.google.com'
}

Then you'll got an update for alpha2.

@LucasFoulonMongai
Copy link

I have found a workaround :
Using the 8.4.0 version ( classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0' )

But it doesn't resolve the compatibility issue with "Feature Module" :
Error:Butterknife plugin can only be applied to android projects

@SebasDesimone
Copy link

SebasDesimone commented Jun 9, 2017

I understand the project can not depend on an unstable version of the gradle plugin (per comment on #964).

So, as far as I see, we could:

  1. Fork the project until a new version address the problem.
  2. Wait until the gradle plugin gets out of alpha, then beta and reach at least a RC version.

Any other option?

@denizmveli
Copy link

Moving the butterknife plugin locally into our projects buildSrc is working for me as a workaround

@iamBedant
Copy link

iamBedant commented Jun 20, 2017

@denizmveli I tried your workaround, In my case, it did not work for "Feature Module"

@linq8261
Copy link

How to solve the problem

@jrodbx
Copy link
Contributor

jrodbx commented Jul 30, 2017

Fixed as of #1026

@nithya-k
Copy link

nithya-k commented Aug 4, 2017

Butterknife is not working with Feature Module to support Instant Apps.
Below are my studio and gradle settings along with compiler error

gradle plugin: classpath 'com.android.tools.build:gradle:3.0.0-alpha8'

project settings: implementation 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'

Studio settings: Android Studio 3.0 Canary 8

error: element value must be a constant expression

Please let me know whether butterknife is supported for instant apps and if yes what changes to be done to make it work.

@MichaelJokAr
Copy link

I have same problem in android studio 3.0 beta2 with butterknife 8.8.1

Error:A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;

@JakeWharton
Copy link
Owner

JakeWharton commented Aug 18, 2017 via email

@MichaelJokAr
Copy link

it's right for use 9.0.0-SNAPSHOT

 maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

but the android studio error :

Error:Could not find com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT.
Searched in the following locations:
    file:/C:/android-studio/android_studio 3.0/android-studio/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
    file:/C:/android-studio/android_studio 3.0/android-studio/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
    file:/C:/android-studio/android_studio 3.0/android-studio/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
    https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
    https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
    https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
Required by:
    project :

@JakeWharton
Copy link
Owner

JakeWharton commented Aug 18, 2017 via email

@MichaelJokAr
Copy link

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
        //huaWei
        maven { url 'http://developer.huawei.com/repo/' }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }

    gradle.taskGraph.whenReady {
        tasks.each { task ->
            if (task.name.contains("Test")) {
                task.enabled = false
            }
        }
    }
}

this is my code

@JakeWharton
Copy link
Owner

JakeWharton commented Aug 18, 2017 via email

@jianinz
Copy link

jianinz commented Aug 22, 2017

Hi @JakeWharton , does order matter when listing out the repositories? I have build.gradle like following, but seems like AS does not search for sonatype repo at all.

buildscript {
    ext.compileSdkVersion = 26
    ext.buildToolsVersion = "26.0.0"
    ext.targetSdkVersion = 26
    ext.minSdkVersion = 21

    ext.kotlin_version = '1.1.3-2'
    ext.supportVersion = "26.0.1"
    ext.daggerVersion = "2.11"
    ext.retrofitVersion = "2.3.0"
    ext.okHttpVersion = "3.8.0"
    ext.butterknifeVersion = "9.0.0-SNAPSHOT"
    ext.rxjavaVersion = "2.1.0"
    ext.rxAndroidVersion = "2.0.1"

    repositories {
        jcenter()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}

Do you have any idea?

@JakeWharton
Copy link
Owner

JakeWharton commented Aug 22, 2017 via email

@jianinz
Copy link

jianinz commented Aug 22, 2017

You need to add it to buildscript repositories too

right, i saw previous comments you put up there, thought i added it there, but still no luck. Am i missing something?

buildscript{
  repositories {
         jcenter()
         maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
  }
}
allprojects {
     repositories {
         jcenter()
         maven { url 'https://maven.google.com' }
         maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
     }
}

@JakeWharton
Copy link
Owner

JakeWharton commented Aug 22, 2017 via email

@jianinz
Copy link

jianinz commented Aug 22, 2017

Error:Could not find com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT.
Searched in the following locations:
    file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
    file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
    file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
    https://plugins.gradle.org/m2/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
    https://plugins.gradle.org/m2/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
    https://plugins.gradle.org/m2/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
    https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
    https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
    https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
Required by:
    project :playerphone

Do i only need to add repo dependency in top-level build gradle file or also need to add it to module as well?

@harshmittal29
Copy link

harshmittal29 commented Sep 11, 2017

Hello guys I am really stuck with above thing. I do not want to use 'me.tatarka:gradle-retrolambda:3.2.4' as a separate plugin

@xiaomanwong
Copy link

don`t update gradle version , you can still use gradle 2.3.3

@AndSync
Copy link

AndSync commented Oct 26, 2017

remove apply plugin: 'com.jakewharton.butterknife' may be worked

@NicolasKun
Copy link

Cool! ['add it to buildscript'] <- it works for me 💯

@SaudM
Copy link

SaudM commented Oct 27, 2017

I remove apply plugin: 'com.jakewharton.butterknife' can works

@Hemen07
Copy link

Hemen07 commented Oct 30, 2017

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

a workaround, tested.

@trinhvanminh2009
Copy link

@Hemen07 I tried like you. But "'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

@Alkarin
Copy link

Alkarin commented Nov 2, 2017

Can't get it to build with gradle 3.0, 9.0.0-SNAPSHOT doesn't seem to work? Tried 8.8.1 aswell.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}

Error:

Error:Could not find com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT.
Searched in the following locations:
file:/opt/android-studio/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
file:/opt/android-studio/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
file:/opt/android-studio/gradle/m2repository/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.pom
https://jcenter.bintray.com/com/jakewharton/butterknife-gradle-plugin/9.0.0-SNAPSHOT/butterknife-gradle-plugin-9.0.0-SNAPSHOT.jar
Required by:
project :

@Aks-4125
Copy link

Aks-4125 commented Nov 7, 2017

Just remove
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
and downgrade butterknife version to 8.4.0
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
if you don't want to downgrade, then.

compile 'com.jakewharton:butterknife:8.8.1'

annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

Don't forget to remove

apply plugin: 'me.tatarka.retrolambda'
from app level build gradle.

@kassim
Copy link

kassim commented Nov 7, 2017

having these in my library's build.gradle seemed to work


buildscript {
    repositories {
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
    }
}

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}


dependencies {
    compile 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
    kapt 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}

thanks Jake

@lxny
Copy link

lxny commented Nov 10, 2017

This is what I tried and worked:
1.Update the gradle to 3.0.0, for example: classpath 'com.android.tools.build:gradle:3.0.0'
2.Replace distributionUrl with distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip in gradle-wrapper properties.
3. add google() in buildscript and allprojects repositories, for example:
buildscript {
repositories {
....
google()
}

allprojects {
repositories {
...
google()
}
}
4. Add this code in defaultConfig, for example:
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
}
more info:https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#apply_plugin

@JImmyBhavsar
Copy link

Resolved by adding dependencies
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

Thank you.

@lawgimenez
Copy link

Documentation should be updated since AS 3.0 has been around for awhile already. Followed the documentation and nothing seemed to work. I followed every comment here and luckily got it to compile.

@MrSinaRJ
Copy link

Android Studio 3.0.1 is out and still not supporting
com.android.tools.build:gradle:3.0.1 doesn't seem to work.
wrapper can be 4.1 but the gradle version MUST be 2.3.3 in order to work

Are we getting update anytime soon?

@palkartimes
Copy link

@Aks-4125 It worked. Thanks

@songhaonangit
Copy link

compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

It worked.Thanks

@Times125
Copy link

you can use gradle 2.3.3.My project can't work if I use gradle 3.0.0.But it works when I use gradle 2.3.3.

@ZQiang94
Copy link

@AndSync @SaudM remove apply plugin: 'com.jakewharton.butterknife' may be worked,but there will be NullPointerException. eg.
22f63eb9-7536-47f6-b824-29ef9be82f10

@configurer
Copy link

yes i'm using Android studio 3.1 Canary 6. It can't find the butter knife jar though gradle.

@redbar0n
Copy link

redbar0n commented Feb 19, 2018

Some additional info from our post-mortem after solving this bug, in case it may contain useful info to help someone else solve it as well:

Problem encountered when upgrading from Android Studio 2.3.2 to Android Studio 3.0.1:

TL;DR:
Don't upgrade to Android Studio 3.0, unless also add this to your app/build.gradle file:

android {
    defaultConfig {
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath true // NB! see doc below
            }
        }
    }

Alternatively, you could instead upgrade the ButterKnife library, but for us that entailed a lot of refactor renaming, and an unknown amount of extra upgrade work, so it was not desirable at this time.

Problem:

  • App crashes on Android mobiles on startup.
    Line 577 in our TimeLineUI.java gives a NullPointerException, because:
    Line 101 in our TimeLineUI.java uses @InjectView to instantiate dashboardBackground, but it is suddenly null at the time it is called.

NB: We didn't make any changes to the codebase. Only the automatic changes Android Studio made to the build.gradle when building in the new Android Studio version.

The stacktrace for the NullPointerException we got, similar to @ZQiang94 :

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: projectname.staging, PID: 6570
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{projectname.staging/projectname.ui.TimeLineUI}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.RelativeLayout.setVisibility(int)' on a null object reference
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
                      at android.app.ActivityThread.-wrap14(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6692)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
                   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.RelativeLayout.setVisibility(int)' on a null object reference
                      at projectname.ui.TimeLineUI.toggleSplashScreen(TimeLineUI.java:577)
                      at projectname.ui.TimeLineUI.initSplashscreen(TimeLineUI.java:553)
                      at projectname.ui.TimeLineUI.onCreate(TimeLineUI.java:178)

Cause and explanation:

The @InjectView annotations in the source code is used by the ButterKnife library to instantiate objects.

If the instantiation isn't done properly then the app crashes on startup, on line 577.

ButterKnife used to instantiate these properly in Android Studio 2.3.2 (where the build would succeed).

We installed Android Studio 3.0 first, and tried to build. It made some changes to build.gradle:

build.gradle (Project: projectname) build script dependencies was upgraded:

-        classpath 'com.android.tools.build:gradle:2.3.3'
+        classpath 'com.android.tools.build:gradle:3.0.1'

Android Studio 3.0 needs annotation processors specifically defined, for annotations to work correctly:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#annotationProcessor_config

If we try to fix it by simply adding this dependency in the app/build.gradle, to match the butterknife version we use:
annotationProcessor 'com.jakewharton:butterknife-compiler:5.5.1'
Then we run into the issue that butterknife-compiler 5.5.1 JAR file doesn't exist (probably the same problem @configurer encountered), because ButterKnife didn't include butterknife-compiler until ButterKnife version 8.2.0.

We could upgrade to ButterKnife 8.2.0 or later.
But ButterKnife uses @BindView in the latest version, instead of @InjectView. So if we upgrade ButterKnife to 8.2.0 or later, then we have to rename all the instances of @InjectView to @BindView in 100+ places in 17+ files, and potentially have to make other changes too. The rename refactoring was attempted, but the upgrade entails we have to change other things in the codebase too. We are uncertain of the is uncertain of the size of the scope, and deems that it could take a while. So it is not worth it, at this time.

So the initial conclusion is that we:

  • Postpone upgrading to Android Studio 3.0 and/or upgrading the ButterKnife library indefinitely, until we absolutely need to do it. If so, use the suggestion by songhaonangit: Android studio 3.0 butterknife error #963 (comment)

  • Quick fix: Downloaded Android Studio 2.3.2 instead, and verified the build works there, when using classpath 'com.android.tools.build:gradle:2.3.2'

Solution:

Was actually able to use Android Studio 3.0 with this small change to the app/build.gradle file (to make it work like in Android Studio 2.3.2):

android {
...
    defaultConfig {
...
        javaCompileOptions {
            annotationProcessorOptions {
                // TODO:
                // includeCompileClasspath should be set to false in future versions, since this option is deprecated and will be removed.
                // This is to increase speed of compilation: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#annotationProcessor_config
                // But when it's set to false be wary of any NullPointerException errors it may cause because of ButterKnife's @InjectView.
                includeCompileClasspath true
            }
        }
    }

@jhass
Copy link

jhass commented Feb 19, 2018

Now this is why it's worth to regularly spend time on updating dependencies.

@arkilis
Copy link

arkilis commented Jun 17, 2018

@AndSync any reason why the apply plugin: 'com.jakewharton.butterknife'caused the issue?

@bqhub30
Copy link

bqhub30 commented Aug 16, 2018

I found this solution
Change:
compile 'com.jakewharton:butterknife:8.+.+'
into
annotationProcessor 'com.jakewharton:butterknife:8.+.+'
it worked for me

@jhass
Copy link

jhass commented Aug 16, 2018

pry(main)> "annotationProcessor 'com.jakewharton:butterknife:8.+.+'" == "annotationProcessor 'com.jakewharton:butterknife:8.+.+'"
=> true

🤔

@sud007
Copy link

sud007 commented Aug 16, 2018

I was solving the 'spot the difference' puzzle by user @bqhub30

But I am also stuck with unable to build ButterKnife !

@gallonyin
Copy link

Error:
Annotation processors must now be declared explicitly. The following dependencies in the compile classpath are found to contain annotation processors. Please add them to the annotationProcessor configuration.

I found this solution:

android {
        ...
        defaultConfig {
            ...
            //config
            javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }
    ...
}

@tonifirnandes
Copy link

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

a workaround, tested.

Thanks work for me, Specs build gradle:

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

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

@mahmoud-coo6
Copy link

follow instruction for GitHub repository which worked for me 100% with the latest version here URL: https://github.com/JakeWharton/butterknife

@wocoficial
Copy link

No meu caso foi apenas o antivírus (KasperSky) que estava filtrando as conexões criptografadas, após desativar voltou ao normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.