android studio 安装完成ButterKnife插件却无法使用(解决方案)
作者:csdm_admin 时间:2023-03-14 17:54:58
ButterKnife 算是一款知名老牌 Android 开发框架了,通过注解绑定视图,避免了 findViewById() 的操作,广受好评!由于它是在编译时对注解进行解析完成相关代码的生成,所以在项目编译时会略耗时,但不会影响运行时的性能。
很多朋友在android studio 安装完成ButterKnife插件后,却无法使用。今天小编把我的解决方法分享出来供大家参考下。
1.在设置里找到插件正常安装好
2.选择activity_main右键Generate菜单中没有相应的插件选项
3.我们需要导入相应的依赖包:
implementation ‘com.jakewharton:butterknife:10.2.1' annotationProcessor ‘com.jakewharton:butterknife-compiler:10.2.1'
两个依赖都要加 不然绑定的控件 报空指针异常
4.在右键试一下ok行了,有相应的ButterKnife插件选项了
5.点击选项自动生成代码
6.需要注意要是.java文件才行不能是kotlin的 .kt文件
来源:https://blog.csdn.net/csdm_admin/article/details/104717617
标签:android,studio,ButterKnife
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
C#关于类的只读只写属性实例分析
2021-06-12 04:24:11
详解C# partial 关键字的使用
2023-06-07 20:46:09
![](https://img.aspxhome.com/file/2023/5/98255_0s.png)
SpringBoot中的响应式web应用详解
2022-05-01 05:47:49
![](https://img.aspxhome.com/file/2023/3/132183_0s.png)
Mybatis使用大于等于或小于等于进行比较
2021-12-25 10:21:44
![](https://img.aspxhome.com/file/2023/6/129216_0s.jpg)
Spring中Bean的三种实例化方式详解
2023-07-28 12:37:07
![](https://img.aspxhome.com/file/2023/5/88145_0s.png)
Android防止按钮重复点击示例代码
2023-10-11 18:15:24
![](https://img.aspxhome.com/file/2023/8/138768_0s.gif)
Android开发Compose框架使用开篇
2023-06-08 19:14:19
![](https://img.aspxhome.com/file/2023/8/94988_0s.jpg)
c# 用Dictionary实现日志数据批量插入
2022-05-29 02:01:45
C# TrackBar拖动条改变滑块颜色
2021-12-22 22:11:07
![](https://img.aspxhome.com/file/2023/5/122695_0s.gif)
Android利用Espresso进行UI自动化测试的方法详解
2021-09-04 08:02:51
![](https://img.aspxhome.com/file/2023/7/139237_0s.jpg)
Android中父View和子view的点击事件处理问题探讨
2022-06-19 04:26:47
SpringBoot 3.0 新特性内置声明式HTTP客户端实例详解
2022-11-25 13:47:20
![](https://img.aspxhome.com/file/2023/9/84289_0s.png)
Java使用Maven BOM统一管理版本号的实现
2023-08-30 00:46:00
基于C#的图表控件库 ScottPlot编译visual studio 2022
2022-05-02 10:24:13
![](https://img.aspxhome.com/file/2023/2/96382_0s.jpg)
Java类加载初始化的过程及顺序
2021-12-09 16:12:46
![](https://img.aspxhome.com/file/2023/8/81928_0s.png)
java Hibernate多对多映射详解及实例代码
2023-07-02 07:24:40
![](https://img.aspxhome.com/file/2023/2/61052_0s.png)
Flutter 快速实现聊天会话列表效果示例详解
2022-10-21 09:18:31
C#网络编程基础之进程和线程详解
2023-03-22 07:38:32
![](https://img.aspxhome.com/file/2023/7/78147_0s.png)
Android绘制圆形百分比加载圈效果
2023-07-16 17:23:38
![](https://img.aspxhome.com/file/2023/1/137221_0s.gif)
C# winform循环播放多个视频
2021-06-30 06:39:21