原作者博客地址:http://blog.csdn.net/dodod2012/article/details/52105824


一、ButterKnife

  -- 项目地址:https://github.com/JakeWharton/butterknife

导入butterknife



二、Android butterknife zelezny 

 -- 项目地址:https://github.com/avast/android-butterknife-zelezny

添加插件 File -->Settings-->Plugins 搜索android butterknife zelezny   安装后重启Android studio

问题:generate 没有Generate ButterKnife Injections选项

解决办法:需要将光标移到setContentView(R.layout.acty_login),将光标放到R.layout.acty_login,然后右键Generate就有了。要注意一定要将光标放在R.layout.acty_login上面。



三、butterknife8.2.1提示NullPointerException空指针的问题,按钮点击无效问题

 原因:空指针及按钮点击无效都是因为gradle配置错误


参考地址:http://my.oschina.net/ximidao/blog/671324?fromerr=qcSNhvAH

          http://bbs.csdn.net/topics/391946592

                  https://segmentfault.com/q/1010000005349657

[html]  view plain  copy  
  1. apply plugin: 'com.android.application'  
  2.   
  3. android {  
  4.     compileSdkVersion 23  
  5.     buildToolsVersion "23.0.3"  
  6.   
  7.     defaultConfig {  
  8.         applicationId "com.first.zparkdemo"  
  9.         minSdkVersion 15  
  10.         targetSdkVersion 23  
  11.         versionCode 1  
  12.         versionName "1.0"  
  13.     }  
  14.     buildTypes {  
  15.         release {  
  16.             minifyEnabled false  
  17.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
  18.         }  
  19.     }  
  20. }  
  21.   
  22. buildscript {  
  23.     repositories {  
  24.         mavenCentral()  
  25.     }  
  26.     dependencies {  
  27.         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'  
  28.     }  
  29. }  
  30.   
  31. apply plugin: 'com.neenbedankt.android-apt'  
  32.   
  33. dependencies {  
  34.     compile fileTree(include: ['*.jar'], dir: 'libs')  
  35.     testCompile 'junit:junit:4.12'  
  36.     compile 'com.android.support:appcompat-v7:23.3.0'  
  37.     compile 'com.jakewharton:butterknife:8.2.1'  
  38.     apt 'com.jakewharton:butterknife-compiler:8.2.1'  
  39. }  

更多相关文章

  1. Android获取设备型号和系统版本号、mac地址、IP、屏幕的分辨率
  2. Android 解决Handler在运行时加载报空指针异常
  3. 最新adb下载地址
  4. Android获取如何获取当前手机IP地址
  5. android 读取mac地址
  6. Android最新资源官方下载地址

随机推荐

  1. AndroidManifest.xml文件详解(uses-config
  2. android发彩信
  3. Android(安卓)api 数据的保存方式
  4. Android的第一个应用(拨打电话)
  5. 学习插画零基础在哪学?插画绘画入门教程
  6. 搭建EXTJS和STRUTS2框架(ext和struts2简
  7. JSP 获取真实IP地址的代码
  8. 不能读取TF卡不能读取的寻回法子
  9. 【北亚服务器数据恢复】ORACLE-SUN-ZFS文
  10. JSP 中文字符处理代码