致命异常:java.lang.NoClassDefFoundError 在某些设备中解析失败:Ljava/time/Month
Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Ljava/time/Month in some devices
我遇到了以下堆栈跟踪崩溃:
Caused by java.lang.ClassNotFoundException
Didn't find class "java.time.Month" on path: DexPathList[[zip file "/data/app/com.my.app/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app/lib/arm, /data/app/com.my.app/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass + 56(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass + 380(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass + 312(ClassLoader.java:312)
at com.my.app.root.path.to.my.Class$disableDays.onMonthChanged + 37(Class.java:37)
at com.applikeysolutions.cosmocalendar.view.CalendarView.containsFlag(CalendarView.java:77)
at com.applikeysolutions.cosmocalendar.view.CalendarView.onSnap + 1073(CalendarView.java:1073)
at com.applikeysolutions.cosmocalendar.utils.snap.GravityDelegate.onScrollStateChanged + 33(GravityDelegate.java:33)
at androidx.recyclerview.widget.RecyclerView.dispatchOnScrollStateChanged + 4998(RecyclerView.java:4998)
at androidx.recyclerview.widget.RecyclerView.setScrollState + 1545(RecyclerView.java:1545)
at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run + 5134(RecyclerView.java:5134)
at android.view.Choreographer$CallbackRecord.run + 910(Choreographer.java:910)
我考虑过我的应用程序可能没有被多重索引,但它已经在我的清单中被多重索引 ();甚至以编程方式对我的应用程序进行多重索引仍然会使这个问题在某些设备上回归。
有什么理由怀疑我的 com.applikeysolutions.cosmocalendar.view.CalendarView
(https://github.com/ApplikeySolutions/CosmoCalendar) 和我的 Proguard 之间的关系有问题吗?到目前为止,该库在我的 Proguard 规则中还没有条目。
谢谢!
如果您想使用混淆器,请尝试在 proguard-rules.pro 中添加 -keep class java.time.Month { *; }
。
java.time
包仅在 API 26.
中添加
https://developer.android.com/reference/java/time/package-summary
对于之前的版本,您可以使用org.joda.time.LocalDate
我遇到了以下堆栈跟踪崩溃:
Caused by java.lang.ClassNotFoundException
Didn't find class "java.time.Month" on path: DexPathList[[zip file "/data/app/com.my.app/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app/lib/arm, /data/app/com.my.app/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass + 56(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass + 380(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass + 312(ClassLoader.java:312)
at com.my.app.root.path.to.my.Class$disableDays.onMonthChanged + 37(Class.java:37)
at com.applikeysolutions.cosmocalendar.view.CalendarView.containsFlag(CalendarView.java:77)
at com.applikeysolutions.cosmocalendar.view.CalendarView.onSnap + 1073(CalendarView.java:1073)
at com.applikeysolutions.cosmocalendar.utils.snap.GravityDelegate.onScrollStateChanged + 33(GravityDelegate.java:33)
at androidx.recyclerview.widget.RecyclerView.dispatchOnScrollStateChanged + 4998(RecyclerView.java:4998)
at androidx.recyclerview.widget.RecyclerView.setScrollState + 1545(RecyclerView.java:1545)
at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run + 5134(RecyclerView.java:5134)
at android.view.Choreographer$CallbackRecord.run + 910(Choreographer.java:910)
我考虑过我的应用程序可能没有被多重索引,但它已经在我的清单中被多重索引 (
有什么理由怀疑我的 com.applikeysolutions.cosmocalendar.view.CalendarView
(https://github.com/ApplikeySolutions/CosmoCalendar) 和我的 Proguard 之间的关系有问题吗?到目前为止,该库在我的 Proguard 规则中还没有条目。
谢谢!
如果您想使用混淆器,请尝试在 proguard-rules.pro 中添加 -keep class java.time.Month { *; }
。
java.time
包仅在 API 26.
https://developer.android.com/reference/java/time/package-summary
对于之前的版本,您可以使用org.joda.time.LocalDate