10

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'

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

Vamsi Abbineni
  • 479
  • 3
  • 7
  • 23
giulicom
  • 123
  • 1
  • 6

7 Answers7

17

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.

Like,

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

to

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

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

Hope it helps.

Shashanth
  • 4,995
  • 7
  • 41
  • 51
0

i have also face this type of error after update android studio 2.1.2 to 2.1.3

try MainActivity extends AppCompatActivity to

MainActivity extends Activity

Rupal Tri
  • 1
  • 1
0

It's should be the same problem as java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener

Try to only use the 24.2.0 version for all the "com.android.support:xxx:..." in your gradle file.

BTW, now, support v4 is split (https://developer.android.com/topic/libraries/support-library/revisions.html#24-2-0-v4-refactor). Try to use only what you need ;)

Community
  • 1
  • 1
ldemay
  • 500
  • 7
  • 22
0

I have also face this type of error after update android studio 2.1.2 to 2.1.3, so I change AppCompat version from 23.4.0 to 24.2.0. Hope it will work! Good luck :)

0

Changing the support library versions to the latest solved my problem.

Snapshot of the constants defined in gradle.properties:

BUILD_TOOLS_VERSION=23.0.2
COMPILE_SDK_VERSION=23
TARGET_SDK_VERSION=23
DESIGN_SUPPORT_VERSION=24.2.0 //changed from 23.2.0
APPCOMPAT_VERSION=24.2.0 //changed from 23.2.0
ANDROID_SUPPORT_VERSION=24.2.0 //changed from 23.2.0

Snapshot of the dependencies I added:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ("com.android.support:appcompat-v7:${project.APPCOMPAT_VERSION}"){
        exclude module: 'support-v4'
    }
    compile "com.google.android.gms:play-services-analytics:${project.PLAY_SERVICES_VERSION}"
    compile "com.google.android.gms:play-services-gcm:${project.PLAY_SERVICES_VERSION}"
    compile "com.android.support:design:${project.DESIGN_SUPPORT_VERSION}"
    compile "com.android.support:recyclerview-v7:${project.ANDROID_SUPPORT_VERSION}"
    compile "com.android.support:cardview-v7:${project.ANDROID_SUPPORT_VERSION}"
    compile "com.google.android.gms:play-services-location:${project.PLAY_SERVICES_VERSION}"
    compile "com.google.android.gms:play-services-maps:${project.PLAY_SERVICES_VERSION}"
    /* google maps*/
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.google.code.gson:gson:2.5'
    compile 'com.jakewharton:disklrucache:2.0.2'
    compile project(':volley')
}
Pang
  • 9,564
  • 146
  • 81
  • 122
Vinay
  • 1,859
  • 22
  • 26
0

here is the issue :

i also faced this this issue once, and i found that i was using invalid dependency in my gradle :

compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'

use this version of design or some other library, it solved my problem.

Thanks

Akshay Paliwal
  • 3,718
  • 2
  • 39
  • 43
0

I was facing the same issue.

These are my configuration: compileSdkVersion 25 buildToolsVersion "25.0.2"

Dependency: compile 'com.android.support:support-v4:25.3.1'

I tried many things but finally it worked by updating Android SDK platform tools.

Steps:

  1. Open SDK Manager
  2. Android SDK -> SDK tools
  3. Select Android SDK Platform - Tools (26.0.0) & Android SDK Tools (26.0.2)
  4. After downloading clean & build your project.
Mahesh Babariya
  • 4,560
  • 6
  • 39
  • 54
Rahul Lad
  • 411
  • 4
  • 10