Java.Lang.Nosuchmethoderror: No Static Method Setonapplywindowinsetslistener

java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener

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.

NoSuchMethodError: No static method setOnApplyWindowInsetsListener

RecyclerView-FastScroll uses the "24.*.*" version of the support libraries, so presumably this is causing a mismatch in the classes its expecting and the ones that are actually present.

Updating your support dependencies to 24 (or to be more up-to-date, 25) will probably fix your problem. See https://stackoverflow.com/a/39108322/1452094

Fatal Exception: NoSuchMethodError: No static method setOnApplyWindowInsetsListener

Please update the following in your gradle file in the following

compileSdkVersion 24
buildToolsVersion "24.0.1"

targetSdkVersion to 24

compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'

Note: Please use the latest version for the libraries and avoid using + like you are doing for your recyclerview. Infact you should be getting this warning as well in android studio.

No static method setOnApplyWindowInsetsListener exception in Android

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.

java.lang.NoSuchMethodError: No static method getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

I was able to resolve this problem. Under my /libs folder I had an old android-support-v13.jar that got compiled with gradle. My app tried to use the ContextCompat class of this .jar and the class didn't have the static getDrawable(Context) method. Removing this .jar solved my problem.

Chrome CustomTab error: java.lang.NoSuchMethodError: No static method startActivity

I updated that code in my app and working perfectly.Because
documentation says 23 version and it throws this error.

mCustomTabsServiceConnection = new CustomTabsServiceConnection() {
@Override
public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient customTabsClient) {
mCustomTabsClient= customTabsClient;
mCustomTabsClient.warmup(0L);
mCustomTabsSession = mCustomTabsClient.newSession(null);
}

@Override
public void onServiceDisconnected(ComponentName name) {
mCustomTabsClient= null;
}
};

CustomTabsClient.bindCustomTabsService(getActivity(), CUSTOM_TAB_PACKAGE_NAME, mCustomTabsServiceConnection);

mCustomTabsIntent = new CustomTabsIntent.Builder(mCustomTabsSession)
.setShowTitle(true)
.build();

and changed in gradle file also

android {
compileSdkVersion 25
buildToolsVersion '25.0.1'

defaultConfig {
applicationId "com.MyApp.app"
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled true
}

compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'

compile 'com.android.support:customtabs:25.1.0+'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'


Related Topics



Leave a reply



Submit