赞
踩
升级 AndroidStudio 以后,默认compileSdkVersion为30,APP运行后报这个错,但不闪退。
- 2021-06-03 10:22:21.478 9096-9096/com.example.mlkitdemo I/zygote64: 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;
- 2021-06-03 10:22:21.478 9096-9096/com.example.mlkitdemo I/zygote64: at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2678)
- //......
- //......
- 2021-06-03 10:22:21.478 9096-9096/com.example.mlkitdemo I/zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.mlkitdemo-yUuuSCpq49HIzilKv738Ow==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.mlkitdemo-yUuuSCpq49HIzilKv738Ow==/lib/arm64, /data/app/com.example.mlkitdemo-yUuuSCpq49HIzilKv738Ow==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
有两种解决办法:
方法一: 降低sdk版本号。
但只能修改到28,修改为27及以下会报错
AAPT: error: style attribute 'android:attr/dialogCornerRadius' not found.
方法二: 修改appcompat版本
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。