Experiencing Crashes on Android 8.0 or 8.1?
If your app has ever crashed with the error message AssertionError: No NameTypeIndex match for SHORT_STANDARD
, you are likely using Date()
or Calendar.getInstance()
to manage date and time. This issue is prevalent on Android 8.0 & 8.1.
Here's how you can resolve this issue by adjusting your time fetching method:
kotlin
Date().time // or Calendar.getInstance().getTimeInMillis();
Instant.now().toEpochMilli() // A more reliable solution for Android 8.0 and above
The method Instant.now().toEpochMilli()
offers a more stable alternative for Android 8.0+ and helps avoid the AssertionError
.