当前位置: 首页 > 新闻动态 > 软件编程

Android添加ButterKnife时报错Error:(2, 0) Cannot add extension with name 'android'的解决办法

作者:用户投稿 浏览: 发布日期:2026-01-12
[导读]:今天小编就为大家分享一篇关于Android添加ButterKnife时报错Error:(2, 0) Cannot add extension with name ‘android‘的解决办法,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧

在添加ButterKnife的时候,根据它的Readme配置以后报错:

Error:(2, 0) Cannot add extension with name 'android', as there is an extension already registered with that name.

解决方法如下:

默认我们在自己的module下添加后是这样的:

apply plugin: 'com.android.application'
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'

此时,我们只需要删掉

apply plugin: 'com.android.library'

这一行就行了,因为它跟com.android.application冲突了。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接

免责声明:转载请注明出处:http://m.jing-feng.com.cn/news/626150.html

扫一扫高效沟通

多一份参考总有益处

免费领取网站策划SEO优化策划方案

请填写下方表单,我们会尽快与您联系
感谢您的咨询,我们会尽快给您回复!