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'
}
Asked
Active
Viewed 3,278 times
1

Philipp Sander
- 10,139
- 6
- 45
- 78

Bunky
- 41
- 1
- 2
-
It still gives error "Error:(26, 0) Could not find method apt() for arguments [com.jakewharton:butterknife-compiler:8.4.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler." – Bunky Apr 28 '17 at 10:58
-
sorry check http://stackoverflow.com/a/39458390/3395198 – IntelliJ Amiya Apr 28 '17 at 10:59
-
Did you solved this yet ? – IntelliJ Amiya Apr 28 '17 at 11:42
2 Answers
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