Open yunikkk opened 3 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Reproduced in 2.0.0-beta.21 as well. I used Turn By Turn example on an Android emulator with default settings. Building 3–4 routes from Europe to South Africa is usually enough for me to trigger the crash.
Adding it to our next milestone to prioritize an investigation to understand the root cause.
Hey @mapbox/navnative, currently in order to pass a route to the nav native (e.g. for Navigator.setRoute
or Navigator.isDifferentRoute
), we have to convert it to a json string. This may lead to OutOfMemoryError
if the route is really long and the device has little memory available. Can there be any alternative to this? On Android it looks like we can pass objects directly which can then be treated as jobject
s, not sure how that would play on iOS though.
@Zayankovsky the alternative would be to make all platforms use our strongly typed objects that the native part may provide and avoid any JSON object parsing in the platform code. However, there is a number of things that should be made first to make it possible.
@mskurydin is this something we want to eventually come to? If so, we should cut a ticket to discuss it.
@Zayankovsky we should explore that option (use NN strongly typed objects) as an additional API (we cannot remove the existing one to avoid breaking SEMVER). Could you cut a NN ticket to track that request?
Android API:any Mapbox Navigation SDK version:1.4.0
Steps to trigger behavior
Crash happens within DirectionsJsonObject at GSON serialization with the following stacktrace :
From my analysis reason is that nav native implementation accepts route as a single string thus fails if string becomes really large. While possible solutions are to pass some Json/Route object entity instead of string, temporary workaround returning some error instead of throwing an exception from background thread would also be nice.
cc @mapbox/navigation-android @mskurydin