美文网首页gradle
Gradle DSL method not found: 

Gradle DSL method not found: 

作者: 小程序 | 来源:发表于2016-10-08 17:56 被阅读231次

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

Error:(27, 0) Gradle DSL method not found: 'apt()'
Possible causes:<ul><li>The project 'TransactionTest' 
may be using a version of Gradle that does not contain themethod.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>
The build file may be missing a Gradle plugin.<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>

解决方法:

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: 

    本文链接:https://www.haomeiwen.com/subject/ntouyttx.html