目录
Android9.0 App安装到Android4.4报错ClassNotFoundException
App在Android9.0上可以运行,但是安装到4.4版本程序crash,错误为ClassNotFoundException,
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.xx.app/com.xx.view.splash.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.xx.view.splash.SplashActivity" on path: DexPathList[[zip file "/data/app/com.xx.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.xx.app-1, /vendor/lib, /system/lib]]
堆栈:
E/AndroidRuntime( 9741): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
E/AndroidRuntime( 9741): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime( 9741): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 9741): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 9741): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 9741): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 9741): at android.app.ActivityThread.main(ActivityThread.java:5047)
E/AndroidRuntime( 9741): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 9741): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 9741): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
E/AndroidRuntime( 9741): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:658)
E/AndroidRuntime( 9741): at dalvik.system.NativeStart.main(Native Method)
解决方案:
将androidx.constraintlayout:constraintlayout的版本从2.0.4修改为2.1.1,问题解决