mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
476 stars 133 forks source link

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

Closed najam-jas-android closed 2 weeks ago

najam-jas-android commented 9 months ago

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);
        }
    }

Note you could refer to issue#7712 on mapbox/mapbox-navigation-android

viktor76525 commented 9 months ago

Mapbox SDK 9.6.1 is not supported https://docs.mapbox.com/android/maps/guides/old-versions. That version older than 3 years old. It's so old, it's not even in the github releases list. You should try updating the SDK first.

kiryldz commented 2 weeks ago

Closing as stale.