1
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.android.booklistingapp"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
      testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.jakewharton:butterknife:8.4.0'

}
Philipp Sander
  • 10,139
  • 6
  • 45
  • 78
Bunky
  • 41
  • 1
  • 2

2 Answers2

3

Add these lines in the build.gradle file in the root directory of your Android Studio project.

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
Puneet Verma
  • 1,373
  • 2
  • 19
  • 23
1

You have to add the classpath for the android-apt plugin:

buildscript {
  repositories {
    mavenCentral()
   }
  dependencies {
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
  }
}

In the dependencies you need also the apt dependency for the compiler:

dependencies {
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.jakewharton:butterknife:8.4.0'
    // Add this
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
}
Giorgio Antonioli
  • 15,771
  • 10
  • 45
  • 70