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.


I am facing same issue but just tried to upgrade dependency for appcompat and it worked no more error logs. I hope there will be new stable release soon. https://developer.android.com/jetpack/androidx/releases/appcompat#1.3.0-alpha02

implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'