Gradle DSL method not found: 'apt()'

新项目的时候引用了ButterKnife的 apt 插件后,构建报错

Error:(27, 0) Gradle DSL method not found: 'apt()'
Possible causes:

解决方法:

Project层的build.gradle

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

module层级的build.gradle

apply plugin: 'android-apt'
android{ 
    ...
}
dependencies { 
    compile 'com.jakewharton:butterknife:8.4.0' 
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
}

你可能感兴趣的:(Gradle DSL method not found: 'apt()')