java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener

☆樱花仙子☆ 提交于 2019-11-27 05:15:49

I upgraded my android studio to 2.1.3. And now I am getting following error

I am also suffering with same issue. But I was resolved as the following way.

Reason of this exception is AppcompatActivity derived from the v7 library. so we should provide proper library based on your gradle and SDK.

  1. should update the dependency Libraries also.
  2. Right click on the project in the project structure -> select Open module settings and select dependencies tab -> Library module-> then type which library you want add to the project. It shows the latest libraries based on your gradle updated version, then select latest one and remove the existing one.

For example In my project "appcompat-v7" version is 23.4.0 then I was changed to 24.2.0.

I had this error coming due to multiple version of same library.

compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.jakewharton:butterknife:8.5.1'

The butterknife was adding the new version of the appcombat lib. I checked it using

./gradlew -q dependencies app:dependencies

The way gradle works it automatically updates the library to new library version, if available. So I added the following code

compile('com.jakewharton:butterknife:8.5.1') {
    exclude module: 'appcompat-v7'
    exclude group: 'com.android.support'
}

It worked fine after that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!