Android 中没有静态方法 setOnApplyWindowInsetsListener 异常 [英] No static method setOnApplyWindowInsetsListener exception in Android
问题描述
我昨天下载了 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
文件(位于 app 模块中)并找到安装的组件版本并在构建中更新它们.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'
到
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 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!