I have a released android app and a strange issue has cropped up with a specific device. On analysis of Crashlytics data, I found that the app is crashing for this particular user (and device) because of the following reason:
val time1 = SimpleDateFormat("MMM dd yyyy HH:mm:ss",Locale.getDefault()).parse(dateString)
where dateString is "Sep 6 2023 14:00:00"
The exact error reported issue is
Caused by java.text.ParseException Unparseable date: "Sep 6 2023 14:00:00"
I have not faced this issue before in other devices. The specifics of the device are:
Device Brand:Xiaomi Model:Redmi Note 10 Pro Orientation:Portrait RAM free: 1.88 GB Disk free: 2.48 GB Operating System Version:Android 13 Orientation:Portrait Rooted:No Crash Date:Sep 5, 2023, 4:19:40 PM App version:6.1.2 (54)
Additional input:
It also fails with
deteString: "Sep 15 2023 24:00:00"
So the problem is not with d or dd
Your date is of single character e.g. '6' in "Sep 6 2023 14:00:00"
Try format "MMM d yyyy HH:mm:ss" as follow:
or update your date generation to '06' for single characters