I have an issue with custom_list_view.Error is on that line setContentView(R.layout.activity_main);

65 views Asked by At
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.os.Looper.loop() (Looper.java:166)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7555)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:469)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:963)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.ahmadraza.firstclass-9SuXVOmOZn38bdZOUd4YXw==/base.apk"],nativeLibraryDirectories=[/data/app/com.ahmadraza.firstclass-9SuXVOmOZn38bdZOUd4YXw==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.support.v4.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2341)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.support.v7.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Object java.lang.reflect.Constructor.newInstance0(java.lang.Object[]) (Constructor.java:-2)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:334)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:658)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:801)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:741)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:874)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:835)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:515)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:423)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:374)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:607)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void com.ahmadraza.firstclass.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:22)
2019-07-24 23:25:56.172 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7343)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7333)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1219)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:3271)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3429)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2009)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:109)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.os.Looper.loop() (Looper.java:166)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7555)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:469)
2019-07-24 23:25:56.173 32051-32051/com.ahmadraza.firstclass I/zygote64:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:963)
2019-07-24 23:25:56.240 32051-32051/com.ahmadraza.firstclass D/HwGalleryCacheManagerImpl: mIsEffect:false
1

There are 1 answers

0
navya sree On

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);
}

} ##