本文介绍了Android中没有静态方法setOnApplyWindowInsetsListener异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨天下载了Android Studio 2.1.3(在我使用1.5之前),现在我有这个例外:

I downloaded yesterday Android Studio 2.1.3 (before I worked with 1.5) and now I have this exception:

java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompatLollipop; or its super classes (declaration of 'android.support.v4.view.ViewCompatLollipop'

应用程序在MainActivity中的setContentView
我如何解决这个问题?

that stops my app on setContentView in the MainActivity. How can I solve this?

推荐答案

我有同样的问题,在另一个系统上运行我的代码,使用最新的Android SDK(API 24)版本。 compileSdkVersion 我的代码是23.所以我做的是我打开 app.iml 文件(位于应用程序模块中),并在build.gradle(应用程序模块)文件中安装并更新组件的版本。

I had same issue. I tried to run my code on another system with latest downloaded version of Android SDK (API 24). compileSdkVersion of my code was 23. So, what I did is I opened app.iml file (located in app module) and found version of components installed and updated them in build.gradle(app module) file.

喜欢,

compile 'com.android.support:design:23.1.1'

to

compile 'com.android.support:design:24.2.0'

还更新了 compileSdkVersion 至24, buildToolsVersion 24.0.1 targetSdkVersion 24
现在我的代码运行正常。

And also updated compileSdkVersion to 24, buildToolsVersion to 24.0.1, targetSdkVersion to 24.Now my code runs fine.

希望它有帮助。

这篇关于Android中没有静态方法setOnApplyWindowInsetsListener异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 17:02