【问题标题】:Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Ljava/time/Month in some devices致命异常:java.lang.NoClassDefFoundError 解析失败:某些设备中的 Ljava/time/Month
【发布时间】:2019-11-28 06:26:18
【问题描述】:

我通过以下堆栈跟踪遇到此崩溃:

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$1.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$1.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)

我考虑过我的应用可能没有被多重索引,但它已经在我的清单中被多重索引(java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/LocalDate; error);甚至以编程方式对我的应用程序进行多 dexing 仍然会使这个问题在某些设备上倒退。

请问有什么理由怀疑我com.applikeysolutions.cosmocalendar.view.CalendarView(https://github.com/ApplikeySolutions/CosmoCalendar) 和我的Proguard 之间的关系有问题吗?到目前为止,该库在我的 Proguard 规则中还没有条目。

谢谢!

【问题讨论】:

  • 然而,我们的 minSdkVersion 是 21...

标签: android proguard android-multidex


【解决方案1】:

java.time 包仅在 API 26 中添加。

https://developer.android.com/reference/java/time/package-summary

对于之前的版本,您可以使用org.joda.time.LocalDate

【讨论】:

    【解决方案2】:

    如果您想使用 proguard,请尝试在您的 proguard-rules.pro 中添加 -keep class java.time.Month { *; }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-31
      • 2020-07-05
      • 1970-01-01
      • 2019-09-27
      相关资源
      最近更新 更多