使用@BindView(R.id.xxx)绑定的view,在网络请求成功后对其进行设置setVisibility,
操作,在个别手机个别情况下报空指针。
我个人猜想是否是,在网络成功返回时,已经不再之前那个界面了,导致view为空,谁遇到过这种情况吗,请指教
使用@BindView(R.id.xxx)绑定的view,在网络请求成功后对其进行设置setVisibility,
操作,在个别手机个别情况下报空指针。
我个人猜想是否是,在网络成功返回时,已经不再之前那个界面了,导致view为空,谁遇到过这种情况吗,请指教
解决方案:
第一种(不建议)把Module里的
compile 'com.jakewharton:butterknife:8.5.1'
修改为
compile 'com.jakewharton:butterknife:7.0.0s'
第二种
先在Project(即自己的工程)的build.gradle中添加如下代码
这里写代码片
classpath ‘com.jakewharton:butterknife-gradle-plugin:8.5.1’
例如
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
然后在在Module的dependencies添加如下代码
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
最后安装ButterKnife插件,重启解决