Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is butterknife 9.0.0-SNAPSHOT not resolving?

I want using AndroidX library and below is my Gradle setup for Butterknife

app:module Dependency

implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
 annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'

Plugin

apply plugin: 'com.jakewharton.butterknife'

Project Dependency

dependencies {
      classpath 'com.android.tools.build:gradle:3.3.0-alpha09'
      classpath 'com.google.gms:google-services:4.0.1'
      classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
    }

Project Repository

repositories {
        google()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        jcenter()
    }
like image 763
Ismail Avatar asked Sep 12 '18 11:09

Ismail


5 Answers

Please note that Butterknife has now reached 10.1.0 and there's no longer need for SNAPSHOT versions or any other maven libraries. AndroidX migration works as a charm. Just include:

dependencies {
    implementation 'com.jakewharton:butterknife:10.1.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}

or, if for some reason you're combining Kotlin and butterknife, replace annotationProcessor with kapt.

For more information, visit: https://github.com/JakeWharton/butterknife

like image 143
Orestis Gartaganis Avatar answered Nov 15 '22 23:11

Orestis Gartaganis


UPDATE: You can now simply use ButterKnife 9-rc02 instead of the above mentioned solutions:

...
dependencies {
    implementation 'com.jakewharton:butterknife:9.0.0-rc2'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
...

Based on the answer from Naveen, the solution is here.
However, there are missing details. Please refer the below Gradle configurations for the complete solution:

buildscript {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven {
            name 'Sonatype SNAPSHOTs';
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
}

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


and

...
dependencies {
    implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
...

Basically, don't use apply plugin: 'com.jakewharton.butterknife' and classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT' from the suggestion here.

Also, this Android Studio Settings > Compiler configuration: Android Studio Settings > Compiler configuration

like image 36
Nabster Avatar answered Nov 15 '22 22:11

Nabster


Add name 'Sonatype SNAPSHOTs';

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3' //3.1.4

    }

    buildscript {
            repositories {
                google()
                jcenter()
                mavenCentral()
                // TODO remove after butterknife 9 graduates to stable
                maven {
                    name 'Sonatype SNAPSHOTs';
                    url 'https://oss.sonatype.org/content/repositories/snapshots/'
                }

            }

FYI

You can use

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

Read Butter Knife

like image 24
IntelliJ Amiya Avatar answered Nov 15 '22 22:11

IntelliJ Amiya


First of All, I'd like to acknowledge @intellij-amiya and @Nabster valuable contribution as this answer is based on the ones they provided.

My Gradle setup is as follows

...
apply plugin: 'com.jakewharton.butterknife'
....
dependencies{
    implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}
...

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        mavenCentral()
        maven {
            name 'Sonatype SNAPSHOTs'
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha09'
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            name 'Sonatype SNAPSHOTs'
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
like image 37
Ismail Avatar answered Nov 15 '22 23:11

Ismail


See that conversation about conflict between Butter Knife 9.0.0-SNAPSHOT and Android studio 3.0.
https://github.com/JakeWharton/butterknife/issues/1145

like image 39
Naveen Avatar answered Nov 15 '22 23:11

Naveen