Butterknife Project Android Studio 3.0

There so many new features in android studio 3.0, but also need to note a couple of things if we want to migrate to android studio 3.0. Yesterday i have been download android studio 3.0 and i found some issue with my butterknife dependency. So here i share with you how to solve that problem.

Add this setting for your top of build.gradle

buildscript {

ext.butterknife_version = '9.0.0-SNAPSHOT'
ext.SUPPORT_LIBRARY_VERSION = '26+'

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

dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-rc1'
classpath "com.jakewharton:butterknife-gradle-plugin:$butterknife_version"
}

}

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

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

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

And for app/build.gradle is look like this :

apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
applicationId "id.sample.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 10
versionName "1.0.0"
}

buildTypes {

release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}

android {
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
}

dependencies {

api fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'

annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife_version"
api "com.jakewharton:butterknife:$butterknife_version"
    api "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
}

And dont forget to set debug mode of butterkinfe.

Like what you read? Give Ahmad Rosid a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.