Skip to content

NullPointer on first navigation launch #978

@kozyr

Description

@kozyr

Android API:
27

Mapbox Navigation SDK version:
0.13

Steps to trigger behavior

  1. Load embedded NavigationView via initialize() call
  2. On callback, start navigation with a route and a progress listener
        NavigationViewOptions.Builder options = NavigationViewOptions.builder();
        options.navigationListener(this);
        options.directionsRoute(myRoute);
        options.shouldSimulateRoute(false);
        options.directionsProfile("driving");
        options.routeListener(this);
        options.navigationOptions(MapboxNavigationOptions.builder()
                .locale(Locale.US)
                .enableNotification(false)
                .build());
        options.progressChangeListener(this);

        navigationView.startNavigation(options.build());
  1. On the first load of navigation, I usually get this exception, and map is centered on Africa, even though right before starting navigation I read out correct location on my own from FusedLocationProvider.
                      java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation.addProgressChangeListener(com.mapbox.services.android.navigation.v5.routeprogress.ProgressChangeListener)' on a null object reference
                          at com.mapbox.services.android.navigation.ui.v5.NavigationViewEventDispatcher.assignProgressChangeListner(NavigationViewEventDispatcher.java:140)
                          at com.mapbox.services.android.navigation.ui.v5.NavigationViewEventDispatcher.initializeListeners(NavigationViewEventDispatcher.java:38)
                          at com.mapbox.services.android.navigation.ui.v5.NavigationView.initNavigationListeners(NavigationView.java:570)
                          at com.mapbox.services.android.navigation.ui.v5.NavigationView.startNavigation(NavigationView.java:376)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions