mapbox/mapbox-navigation-android

Any tile edge can only be used once as part of the geometry

najam-jas-android opened this issue · 0 comments

Environment

  • Android OS version: Android 7+
  • Devices affected: Samsung, Oppo, Xiomi etc
  • Maps SDK Version: sdk:9.6.1

Observed behavior and steps to reproduce

I'm using UI as module in my android project,
But observing this exception, occurring multiple time, but couldn't know about the root caused.

Fatal Exception: java.lang.Error: Any tile edge can only be used once as part of the geometry
at com.mapbox.navigator.Navigator.getRouteBufferGeoJson(SourceFile) at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigator.retrieveRouteGeometryWithBuffer(MapboxNavigator.java:2)
at com.mapbox.services.android.navigation.v5.navigation.NavigationRouteProcessor.updateRoute(NavigationRouteProcessor.java:22) at com.mapbox.services.android.navigation.v5.navigation.NavigationRouteProcessor.buildNewRouteProgress(NavigationRouteProcessor.java:22)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorRunnable.process(RouteProcessorRunnable.java:55)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorRunnable.run(RouteProcessorRunnable.java:55)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:268)
at android.os.HandlerThread.run(HandlerThread.java:67)

What I have DONE to get rid of it:

InSDKClass: MapboxNavigator:
I have updated this method to:


    @Nullable
    synchronized Geometry retrieveRouteGeometryWithBuffer() {
        String routeGeometryWithBuffer = navigator.getRouteBufferGeoJson(GRID_SIZE, BUFFER_DILATION);
        if (routeGeometryWithBuffer == null) {
            return null;
        }
        return GeometryGeoJson.fromJson(routeGeometryWithBuffer);
    }

as this

    @Nullable
    synchronized Geometry retrieveRouteGeometryWithBuffer() {
        try {
            String routeGeometryWithBuffer = navigator.getRouteBufferGeoJson(GRID_SIZE, BUFFER_DILATION);
            if (routeGeometryWithBuffer == null) {
                return null;
            }
            return GeometryGeoJson.fromJson(routeGeometryWithBuffer);
        }catch(Exception e){
            return null;
        }
    }

and also:
From class: NavigationRouteProcessor
I have updated some other method too
BASE Calling METHOD:

   private void updateRoute(DirectionsRoute route, MapboxNavigator navigator) {
        if (this.route == null || !this.route.equals(route)) {
            this.route = route;
            routeGeometryWithBuffer = navigator.retrieveRouteGeometryWithBuffer();
        }
    }

And Changed Method original:

private void addRouteGeometries(RouteProgress.Builder progressBuilder) {
            progressBuilder.routeGeometryWithBuffer(routeGeometryWithBuffer);
    }

UPDATED:

    private void addRouteGeometries(RouteProgress.Builder progressBuilder) {
        if (routeGeometryWithBuffer != null) {
            progressBuilder.routeGeometryWithBuffer(routeGeometryWithBuffer);
        }
    }