There are no clear steps to reproduce.
I register route progress listener and start navigation. From time to time I get
java.lang.NullPointerException
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:652)
at java.text.DateFormat.get(DateFormat.java:808)
at java.text.DateFormat.getTimeInstance(DateFormat.java:487)
at android.text.format.DateFormat.is24HourFormat(DateFormat.java:193)
at android.text.format.DateFormat.is24HourFormat(DateFormat.java:168)
at com.mapbox.navigation.ui.summary.SummaryModel.<init>(SummaryModel.java:30)
at com.mapbox.navigation.ui.summary.SummaryBottomSheet.update(SummaryBottomSheet.java:167)
@evabishchevich - which Android version you saw this issue?
did you change device locale? Or the device just sit there and after a while it crashed with NPE? How many times have you see this issue?
It was an emulator with API 27. I didn't change locale, just was actively starting and stopping navigation and got this NPE. I'd say this crash is quite seldom, I saw 5-7 times during a week
I saw 5-7 times during a week
Well, that's quite often! Thanks for the additional info.
NP. I'll try to capture more details when/if see it next time
@JunDai Here is some gif/video

Tried to reproduce it on a real phone, API 28, got the following stacktrace
java.lang.NullPointerException: locale == null
at libcore.icu.LocaleData.get(LocaleData.java:134)
at java.text.SimpleDateFormat.getDateTimeFormat(SimpleDateFormat.java:597)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:593)
at java.text.DateFormat.get(DateFormat.java:817)
at java.text.DateFormat.getTimeInstance(DateFormat.java:487)
at android.text.format.DateFormat.is24HourLocale(DateFormat.java:206)
at android.text.format.DateFormat.is24HourFormat(DateFormat.java:188)
at android.text.format.DateFormat.is24HourFormat(DateFormat.java:169)
at com.mapbox.navigation.ui.summary.SummaryModel.<init>(SummaryModel.java:30)
at com.mapbox.navigation.ui.summary.SummaryBottomSheet.update(SummaryBottomSheet.java:167)
@evabishchevich - thanks a lot for the gif and stacktrace. it's helpful.
Tried to reproduce it on a real phone, API 28, got the following stacktrace
java.lang.NullPointerException: locale == null at libcore.icu.LocaleData.get(LocaleData.java:134) at java.text.SimpleDateFormat.getDateTimeFormat(SimpleDateFormat.java:597) at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:593) at java.text.DateFormat.get(DateFormat.java:817) at java.text.DateFormat.getTimeInstance(DateFormat.java:487) at android.text.format.DateFormat.is24HourLocale(DateFormat.java:206) at android.text.format.DateFormat.is24HourFormat(DateFormat.java:188) at android.text.format.DateFormat.is24HourFormat(DateFormat.java:169) at com.mapbox.navigation.ui.summary.SummaryModel.<init>(SummaryModel.java:30) at com.mapbox.navigation.ui.summary.SummaryBottomSheet.update(SummaryBottomSheet.java:167)
this looks very similar to https://github.com/mapbox/mapbox-navigation-android/issues/2891 while both crash are causing by the NULL locale. 馃

The OS source code indicates the locale is NonNull but we get this NPE.
@evabishchevich - which device are you using? I tried 1TAP app and also the Navigation example app by starting/cancelling the navigation back and forth. I can't reproduce this issue. I am using a Samsung S9+ OS 10.
@mapbox/navigation-android - anyone else has idea, thoughts?
I have a draft PR #2980 to just add the try/catch protection to this NPE. But any suggestions are welcome.
@JunDai I used an emulator, Pixel 2 API 27
Tried to reproduce it on a real phone, API 28, got the following stacktrace
@evabishchevich - on which real phone you got that stacktrace?
@JunDai Honor 10, Android 9.
Confirmed with @evabishchevich the detailed reproduced steps but I still couldn't reproduce it by using the same steps and emulator.
I changed the PR to use the applicationContext which is same as we did in MapboxTripNotification, hope it fixes the issue. Otherwise the NPE try/catch can help to avoid crash.
The potential fix for this issue has been merged into UI SDK.
@evabishchevich - once you integrate the next UI SDK release in 1TAP, can you please help to verify this issue and update here?
thanks 馃檱
@JunDai I'll do it after the next release
Looks like everything is fine.