1、File-Settings-Plugins,搜插件butterknife安裝圖中工具

image.png
2、光標(biāo)放到布局處,Alt+Insert(或者鼠標(biāo)右鍵選中Generate),點擊ButterKnife IInjections即可
注意:關(guān)閉再次打開studio如果出現(xiàn)報錯 Plugin "Android ButterKnife Injections (Support Kotlin)" is incompatible (supported only in IntelliJ IDEA). 不兼容的情況,請將該插件的默認(rèn)安裝目錄(我的是:C:\Users\89018166\AppData\Local\Google\AndroidStudio4.2\plugins)下面的對應(yīng)文件移至Android Studio的安裝目(我的是:E:\as1\plugins)下。

image.png
先從箭頭指向的路徑將插件的jar復(fù)制出來。

image.png
找到AS安裝的地方,并找到箭頭指向的路徑,復(fù)制到里面就可以了。