Search code examples
androidandroid-studiomapboxmapbox-android

Mapbox UI classes cannot be imported


I am following this tutorial: https://docs.mapbox.com/help/tutorials/android-navigation-sdk/

No matter what I do these packages cannot be imported.

import com.mapbox.services.android.navigation.ui.v5.NavigationLauncherOptions;
import com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute;
import com.mapbox.services.android.navigation.ui.v5.NavigationLauncher;

This is the error I get: package com.mapbox.services.android.navigation.ui.v5 does not exist

Any help will be highly appreciated.


Solution

  • Apparently, the tutorial is missing about one attribute that has to be imported in the gradle. So,

    Aside from adding:

    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.42.6'
    

    You must add this too:

    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'