1. 程式人生 > >android studio 3.0 與 butterknife 配置衝突

android studio 3.0 與 butterknife 配置衝突

android studio從2.0 升級到3.0後,會發現原來的專案會有butterknife 報錯,網上也有很多文章說明,試了很多都沒有用。

經過一番自我檢查與重新配置以後,終於找到解決方法,現將其分享給大家,希望能幫到需要的童鞋。

1.將project 的build.gradle中的外掛註釋掉,並加入google()

  如下圖:

2.將module的build.gradle 的外掛註釋掉

3. 將下面的2.0配置更改 

compile 'com.jakewharton:butterknife:8.4.0'

    apt 'com.jakewharton:butterknife-compiler:8.4.0'

更改為:

implementation'com.jakewharton:butterknife:8.4.0'

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

注意:編譯器如果還報錯,就刪除butterknife配置,從 module Settings重新新增一下即可

4.其他的compile 也更改為implementation