Android studio 引入ButterKnife注解流程

经过百度查找以及实验,做个笔记,以方便查阅,总结如下(其实就是copy部分文字):

1、点击android studio 的“File”,选择选择“Project Structrue……”

2、在“Project Structrue”页面中,点击左边的“app”,然后点击顶部导航的“Dependencies,再然后点击左边“+”,选择第一个

3、在打开的页面中,输入“butterknife”搜索,我选择的是第一个,然后点击“OK”

4、打开project下的“build.gradle”,然后在"dependencies"下增加了

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

5、打开app文件夹下的“build.gradle”,添加

apply plugin: 'android-apt'

apt 'com.jakewharton:butterknife-compiler:8.1.0'

然后点击“Sync Now”,

6、引入完成


发布了7 篇原创文章 · 获赞 8 · 访问量 1万+
展开阅读全文

Android Studio配置使用butterknife错误

08-10

Module gradle apply plugin: 'com.android.library' apply plugin: 'com.jakewharton.butterknife' android { compileSdkVersion 26 buildToolsVersion "26.0.2" defaultConfig { minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:26.0.0-alpha1' testCompile 'junit:junit:4.12' compile project(':latte-annotations') //字体图标 compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2' compile 'com.joanzapata.iconify:android-iconify-ionicons:2.2.2' //Fragmenttation第三方库 compile 'me.yokeyword:fragmentation:1.3.5' compile 'me.yokeyword:fragmentation-swipeback:1.3.5' //butterknife compile 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' } App gradle buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } gradle wrapper.properties #Mon Dec 28 10:00:20 PST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip ![图片说明](https://img-ask.csdn.net/upload/201808/10/1533871469_384842.png) 配置后给出错误提示 Error:(1, 0) Minimum supported Gradle version is 3.3. Current version is 2.14.1. If using the gradle wrapper, try editing the distributionUrl in E:\AndroidCode\TaoJB\gradle\wrapper\gradle-wrapper.properties to gradle-3.3-all.zip <a href="openFile:E:\AndroidCode\TaoJB\example\build.gradle">Open File</a> 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览