gpt4 book ai didi

android - Api 28 类是从 androidx 的支持库中调用的

转载 作者:行者123 更新时间:2023-11-29 14:34:38 29 4
gpt4 key购买 nike

我在我的 Android 手机上尝试运行 Debug模式时遇到了这个问题。

应用程序找不到 OnUnhandledKeyEventListener 是合理的,因为它是在 api 28 中添加的,而我的手机运行 api 27,但为什么它甚至会尝试,而它应该是一个支持库?这是库中的错误还是我遗漏了什么?即使您创建空的 android studio 项目并进行重构 -> 迁移到 AndroidX,也会发生这种情况

    I/zygote64: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2422)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:141)
at void com.infradev.lessontimer.LoginActivity.onCreate(android.os.Bundle) (LoginActivity.java:25)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7084)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7075)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1215)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1613)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:171)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6635)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:547)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/base.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_resources_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_4_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_5_apk.apk", zip file "/data/ap
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2422)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:141)
at void com.infradev.lessontimer.LoginActivity.onCreate(android.os.Bundle) (LoginActivity.java:25)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7084)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7075)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1215)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1613)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:171)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6635)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:547)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:823)
Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2422)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:141)
at void com.infradev.lessontimer.LoginActivity.onCreate(android.os.Bundle) (LoginActivity.java:25)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7084)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7075)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1215)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1613)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:171)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6635)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:547)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/base.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_resources_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_4_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_5_apk.apk", zip file "/data/ap
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2422)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:141)
at void com.infradev.lessontimer.LoginActivity.onCreate(android.os.Bundle) (LoginActivity.java:25)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7084)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7075)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1215)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1613)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:171)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6635)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:547)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:823)
I/zygote64: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2422)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:141)
at void com.infradev.lessontimer.LoginActivity.onCreate(android.os.Bundle) (LoginActivity.java:25)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7084)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7075)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1215)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1613)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:171)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6635)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:547)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:823)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/base.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_resources_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_4_apk.apk", zip file "/data/app/com.infradev.lessontimer-oANosPd_Q6S3fKsdUvgGLg==/split_lib_slice_5_apk.apk", zip file "/data/ap
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2422)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:141)
at void com.infradev.lessontimer.LoginActivity.onCreate(android.os.Bundle) (LoginActivity.java:25)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7084)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7075)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1215)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2767)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1613)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:171)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6635)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:547)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:823)

最佳答案

Is it a bug in library or I'm missing something?

这是来自合子 (I/zygote64) 的信息消息。这不是错误。没有错。

当加载引用了无法识别的符号 (View.OnUnhandledKeyEventListener) 的类 (ViewCompat) 时,即使代码不会尝试使用这些符号。

关于android - Api 28 类是从 androidx 的支持库中调用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53926086/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com