butterknife 使用步骤

来源:互联网 发布:博彦科技数据分析师 编辑:程序博客网 时间:2024/06/05 20:06

在用butterknife 的时候遇到了个问题  

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>


在引用插件后出现这个错误   ;想着干脆把用黄油刀的步骤记录一下


1.在setting中的pluging中下载butterknife 插件  (是用来做快捷键的)



2.在工程的build.gradle <切记是在工程project里>添加

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
这个很重要!!!!



3.在项目里的build.gradle中<是mudule>中添加引用

compile 'com.jakewharton:butterknife:8.4.0'apt 'com.jakewharton:butterknife-compiler:8.4.0'

和顶部添加

apply plugin: 'android-apt'

最上面那个问题就是顶部没加这一条    做完这三部就ok了!!!


原创粉丝点击