Androidx:Appcompat I:Art Error Android.View.View$Onunhandledkeyeventlistener

AndroidX:Appcompat I:art error android.view.View$OnUnhandledKeyEventListener

As A.L.Flanagan mentioned in a comment the problem is that android.support.v4.view.ViewCompat does not implement View.OnUnhandledKeyEventListener in the new androidx package structure and only implements it starting on API 28 in the support lib structure (at least in version 28.0.0). Therefore the warning appears on devices with API <28 and does not appear on those >=28.

This is the related code in the ViewCompat.class class from the support package structure:

@RequiresApi(28)
private static class OnUnhandledKeyEventListenerWrapper implements OnUnhandledKeyEventListener {
private ViewCompat.OnUnhandledKeyEventListenerCompat mCompatListener;

OnUnhandledKeyEventListenerWrapper(ViewCompat.OnUnhandledKeyEventListenerCompat listener) {
this.mCompatListener = listener;
}

public boolean onUnhandledKeyEvent(View v, KeyEvent event) {
return this.mCompatListener.onUnhandledKeyEvent(v, event);
}
}

I can not think about any easy fix to solve this warning.

android.view.View$OnUnhandledKeyEventListener

Make the changes in your build.gradle (app level) to downgrade to version 27 as below. Then sync and build project. Hopefully it will fix the issue..

compileSdkVersion 27

targetSdkVersion 27

implementation 'com.android.support:appcompat-v7:27.1.1'

AndroidX:Appcompat I:art error android.view.View$OnUnhandledKeyEventListener

As A.L.Flanagan mentioned in a comment the problem is that android.support.v4.view.ViewCompat does not implement View.OnUnhandledKeyEventListener in the new androidx package structure and only implements it starting on API 28 in the support lib structure (at least in version 28.0.0). Therefore the warning appears on devices with API <28 and does not appear on those >=28.

This is the related code in the ViewCompat.class class from the support package structure:

@RequiresApi(28)
private static class OnUnhandledKeyEventListenerWrapper implements OnUnhandledKeyEventListener {
private ViewCompat.OnUnhandledKeyEventListenerCompat mCompatListener;

OnUnhandledKeyEventListenerWrapper(ViewCompat.OnUnhandledKeyEventListenerCompat listener) {
this.mCompatListener = listener;
}

public boolean onUnhandledKeyEvent(View v, KeyEvent event) {
return this.mCompatListener.onUnhandledKeyEvent(v, event);
}
}

I can not think about any easy fix to solve this warning.

How to resolve NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;

Sometimes after an upgrade, you need to invalidate and clear cache.

Sample Image

There are some known issues in 3.2 so also ensure you are not on Kotlin tools
org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.70

as that causes freeze issues as well.
If that doesn't work, remove your google plugin lines and support libraries, sync and add them again and sync. Sometimes the cache directories just get out of whack.



Related Topics



Leave a reply



Submit