Plugin Error: Plugin Android Butterknife Injections( Support Kotlin)is incompatible (supported only

Plugin Error: Plugin Android Butterknife Injections( Support Kotlin)is incompatible (supported only in Intellij IDEA)

问题描述:Android studio升级版本至4.1后出现android studio闪退问题

发现在打开android studio时会有一个提示Plugin Error: Plugin Android Butterknife Injections( Support Kotlin)is incompatible (supported only in Intellij IDEA),翻译为:插件错误:插件Android Butterknife Injections(Support Kotlin)不兼容(仅在Intellij IDEA中受支持)

问题原因:升级4.1版本后ButterKnife插件不兼容

解决方法:

打开访达,====>用户目录====>Library/Application Support/Google/AndroidStudio4.1/plugins ,按照这个目录打开方式会找到自己安装的插件,将不兼容的插件删除即可。

参考文章:https://blog.csdn.net/qq_26287435/article/details/90676195

删除成功后通过添加依赖使用ButterKnife:

打开android studio app下的build.gradle,(注意build.gradle有app状态下和project状态下两种之分,我们这里要打开的是app状态下的build.gradle)

然后添加依赖:

1、先在project下的build.gradle中添加:

dependencies {
    classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
  }

2、然后在app下的build.gradle中添加: 

dependencies{
    implementation 'com.jakewharton:butterknife:10.2.3',
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
}

 github网址:https://github.com/JakeWharton/butterknife 中有详细配置

完成添加依赖后就可以使用BindView注解代替findViewById啦

(注意:ButterKnife.bind(this)必须在setContentView之后。)

  public class MainActivity extends AppCompatActivity {
      @BindView(R.id.tv_title)
      TextView tvTitle;
      @BindView(R.id.iv_photo) 
      Button ivPhoto;
      
      
      @Override 
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          ButterKnife.bind(this);
      }
  }

还可参考另一篇文章ButterKnife的使用 https://blog.csdn.net/CHenhong_666/article/details/108239374?spm=1001.2014.3001.5502

 

  • 15
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值