问题
android 跑androidx库后,app跑起来后会有异常出现
Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
I/zygote: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
I/zygote: at int androidx.core.view.ViewCompat.getImportantForAutofill(android.view.View) (ViewCompat.java:772)
I/zygote: at void androidx.recyclerview.widget.RecyclerView.initAutofill() (RecyclerView.java:747)
I/zygote: at void androidx.recyclerview.widget.RecyclerView.<init>(android.content.Context, android.util.AttributeSet, int) (RecyclerView.java:671)
I/zygote: at void androidx.recyclerview.widget.RecyclerView.<init>(android.content.Context, android.util.AttributeSet) (RecyclerView.java:650)
I/zygote: at java.lang.Object java.lang.reflect.Constructor.newInstance0(java.lang.Object[]) (Constructor.java:-2)
I/zygote: at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:334)
I/zygote: at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:647)
I/zygote: at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:790)
I/zygote: at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:730)
I/zygote: at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:492)
I/zygote: at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:423)
I/zygote: at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:374)
解决
implementation 'androidx.appcompat:appcompat:1.2.0'
改成
implementation 'androidx.appcompat:appcompat:1.3.0'