You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm building an application with offline routing support. After implementing the solution as described in the documentation, I faced an issue where offline (onboard) routes are only generated as a fallback. The SDK attempts to make an online request first, and after it fails (due to a timeout), it returns a locally built route.
Is there a way to configure the SDK to build routes entirely offline?
@voltazor hey sir, how you build the offline routing using naviagtion and mapbox sdk. i also working on it, i downlaoded tile succesfully but when i try to generate the offline route , this first try to generate the route from offline (onboard) router but it ended with some tile problem and try after online route
this was the logcat of error:-
[nav-native]: LatestFromServer resolved with "version: <>"
2025-01-28 14:48:55.253 11211-11279 Mapbox com.mapbox_offline I [nav-native]: Loaded PersistentConfig: {"tiles":{"latestVersions":[{"dataSet":"mapbox/driving","version":"2025_01_26-03_00_05","metadata":{"map":{"tileset_version":"2025_01_26-03_00_05"}},"discoveryTime":"2025-01-28T09:18"}]}}
2025-01-28 14:48:55.261 11211-11279 Mapbox com.mapbox_offline I [nav-native]: LatestFromConfig resolved with "version: 2025_01_26-03_00_05 discoveryTime: 2025-01-28T09:18 meta: {"map":{"tileset_version":"2025_01_26-03_00_05"}}"
2025-01-28 14:48:55.263 11211-11211 Mapbox com.mapbox_offline I [nav-native]: Tiles path = "/data/user/0/com.mapbox_offline/files/mapbox/tili"
2025-01-28 14:48:55.266 11211-11211 Mapbox com.mapbox_offline I [nav-native]: TileStore instance was passed
2025-01-28 14:48:55.267 11211-11211 Mapbox com.mapbox_offline I [nav-native]: Endpoint config = "{"host":"https://api.mapbox.com","dataSet":"mapbox/driving","version":"","token":"***...*","isFallback":false,"versionBeforeFallback":"","minDiffInDaysToConsiderServerVersion":56}"
2025-01-28 14:48:55.269 11211-11211 Mapbox com.mapbox_offline I [nav-native]: Creating navigator v.206.0.0
2025-01-28 14:48:55.270 11211-11211 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.270 11211-11211 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.274 11211-11248 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.275 11211-11248 chatty com.mapbox_offline I uid=10150(com.mapbox_offline) Worker 1 identical 2 lines
2025-01-28 14:48:55.275 11211-11248 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.275 11211-11279 Mapbox com.mapbox_offline I [nav-native]: Async version config for mapbox/driving resolved with version 2025_01_26-03_00_05 [{"map":{"tileset_version":"2025_01_26-03_00_05"}}]
2025-01-28 14:48:55.333 11211-11386 Mapbox com.mapbox_offline I [threading]: Worker 1 priority is now 4
2025-01-28 14:48:55.343 11211-11387 Mapbox com.mapbox_offline I [threading]: Worker 1 priority is now 4
2025-01-28 14:48:55.368 11211-11248 Mapbox com.mapbox_offline I [nav-native]: Requesting online route id 0: https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?access_token=****attg&geometries=polyline6&steps=true&compute_toll_cost=false
2025-01-28 14:48:55.400 11211-11279 Mapbox com.mapbox_offline I [nav-native]: Directions Service: FetchDirections request error (type 'ConnectionError'): Unable to resolve host "api.mapbox.com": No address associated with hostname
2025-01-28 14:48:55.401 11211-11279 Mapbox com.mapbox_offline E [nav-native]: OnlineRouter::getRoute req id 0 failed w/error: Unable to resolve host "api.mapbox.com": No address associated with hostname in 0.0314206 seconds
2025-01-28 14:48:55.410 11211-11248 Mapbox com.mapbox_offline I [nav-native]: Online response id 0 returned Unable to resolve host "api.mapbox.com": No address associated with hostname
2025-01-28 14:48:55.410 11211-11248 Mapbox com.mapbox_offline I [nav-native]: Onboard router: Get route request id 0: https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?access_token=****attg&geometries=polyline6&steps=true&compute_toll_cost=false
2025-01-28 14:48:55.411 11211-11248 Mapbox com.mapbox_offline I [nav-native]: getRoute: URI parsed successfully
2025-01-28 14:48:55.411 11211-11248 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.491 11211-11248 Mapbox com.mapbox_offline I [nav-native]: RouteBuilder::build: Building request to onboard
2025-01-28 14:48:55.491 11211-11248 Mapbox com.mapbox_offline I [nav-native]: RouteBuilder::build: locate the coordinates within the graph
2025-01-28 14:48:55.500 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.514 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.520 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.530 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.535 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.570 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.575 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.589 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.600 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.603 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.610 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.615 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.629 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.633 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.636 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.638 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.645 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.649 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.651 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.657 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.662 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.665 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.670 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.675 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.677 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.683 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.704 11211-11248 Mapbox com.mapbox_offline E [nav-native]: RouteBuilder::build error: No suitable edges near location
2025-01-28 14:48:55.710 11211-11248 Mapbox com.mapbox_offline E [nav-native]: getRoute("https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?access_token=****attg&geometries=polyline6&steps=true&compute_toll_cost=false") id 0 failed: RouterException No suitable edges near location
2025-01-28 14:48:55.710 11211-11249 Mapbox com.mapbox_offline I [nav-native]: Onboard response id 0 returned No suitable edges near location
2025-01-28 14:48:55.718 11211-11211 Mapbox com.mapbox_offline W [nav-sdk]: [RouterWrapper] Route request failed with:
[RouterFailure(url=https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?geometries=polyline6&steps=true&compute_toll_cost=false&access_token=redacted, routerOrigin=com.mapbox.navigation.base.route.RouterOrigin$Offboard@2fd6700, message=Unable to resolve host "api.mapbox.com": No address associated with hostname, code=406, throwable=com.mapbox.navigation.base.internal.route.RetryableThrowable: It makes sense to retry in case of that error)]
2025-01-28 14:48:55.718 11211-11211 Navigation com.mapbox_offline D Failed to get routes: [RouterFailure(url=https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?geometries=polyline6&steps=true&compute_toll_cost=false&access_token=redacted, routerOrigin=com.mapbox.navigation.base.route.RouterOrigin$Offboard@2fd6700, message=Unable to resolve host "api.mapbox.com": No address associated with hostname, code=406, throwable=com.mapbox.navigation.base.internal.route.RetryableThrowable: It makes sense to retry in case of that error)]
2025-01-28 14:48:55.718 11211-11211 RouterFailure com.mapbox_offline E URL: https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?geometries=polyline6&steps=true&compute_toll_cost=false&access_token=redacted
2025-01-28 14:48:55.718 11211-11211 RouterFailure com.mapbox_offline E Message: Unable to resolve host "api.mapbox.com": No address associated with hostname
2025-01-28 14:48:55.718 11211-11211 RouterFailure com.mapbox_offline E Code: 406
2025-01-28 14:48:55.719 11211-11211 RouterFailure com.mapbox_offline E Throwable: (Ask Gemini)
com.mapbox.navigation.base.internal.route.RetryableThrowable: It makes sense to retry in case of that error
at com.mapbox.navigation.route.internal.RouterWrapper$getRoute$2$2$1.invokeSuspend(RouterWrapper.kt:100)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
The problem I'm facing is that offline built route won't be produced until online request in the process.
It could take 20-30 seconds until request fails with the timeout, which is not an option.
TileStore tileStore ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
btn_submit = findViewById(R.id.btn_submit);
btn_tile=findViewById(R.id.btn_tile);
String tileStorePath = getFilesDir().getPath() + "/mapbox/tili";
tileStore = TileStore.create(tileStorePath);
btn_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Clean up existing instance of MapboxNavigation if it exists
if (mapboxNavigation != null) {
mapboxNavigation.onDestroy(); // Destroy the previous instance to prevent memory leaks
mapboxNavigation = null; // Set it to null to allow the new instance to be created
}
generateRoute();
}
});
btn_tile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Clean up existing instance of MapboxNavigation if it exists
downloadTile();
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
// Clean up MapboxNavigation when the activity is destroyed
if (mapboxNavigation != null) {
mapboxNavigation.onDestroy();
mapboxNavigation = null; // Clear reference
}
}
public void downloadTile(){
tileStore.setOption(TileStoreOptions.MAPBOX_ACCESS_TOKEN,
TileDataDomain.MAPS,
new Value(getString(R.string.mapbox_access_token))
);
tileStore.setOption(
TileStoreOptions.MAPBOX_ACCESS_TOKEN,
TileDataDomain.NAVIGATION,
new Value(getString(R.string.mapbox_access_token))
);
Map<String, Object> metadataMap = new HashMap<>();
metadataMap.put("name", "region-233");
metadataMap.put("date_created", System.currentTimeMillis());
metadataMap.put("version", "1.0");
// Convert the Map to a Value object
Value metadata = fromJson(new JSONObject(metadataMap).toString()).getValue();
ResourceOptions resourceOptions = new ResourceOptions.Builder()
.accessToken(getString(R.string.mapbox_access_token))
.tileStore(tileStore)
.tileStoreUsageMode(TileStoreUsageMode.READ_AND_UPDATE)
.build();
StylePackLoadOptions stylePackLoadOptions = new StylePackLoadOptions.Builder()
.glyphsRasterizationMode(GlyphsRasterizationMode.IDEOGRAPHS_RASTERIZED_LOCALLY)
.metadata(new Value("Your metadata here"))
.build();
OfflineManager offlineManager = new OfflineManager(resourceOptions);
// Create a tileset descriptor
TilesetDescriptorOptions navTilesetDescriptorOptions = new TilesetDescriptorOptions.Builder()
.styleURI(Style.OUTDOORS)
.stylePackOptions(stylePackLoadOptions )
.minZoom((byte) 2)
.maxZoom((byte) 16)
.build();
Polygon TOKYO = Polygon.fromLngLats(Collections.singletonList(Arrays.asList(
Point.fromLngLat( -6.8460791525943945,61.99126465695252), // Point 1
Point.fromLngLat( -6.855335344786206,62.036056927981676), // Point 2
Point.fromLngLat( -6.759923710060881,62.03660476011243),
Point.fromLngLat( -6.745904041284915,61.998964025019404),// Point 3
Point.fromLngLat( -6.8460791525943945,61.99126465695252) // Point 4
)));
TileRegionLoadOptions tileRegionLoadOptions = new TileRegionLoadOptions.Builder()
.geometry(TOKYO)
.metadata(valueOf(12))
.networkRestriction(NetworkRestriction.NONE)
.descriptors(Collections.singletonList(
offlineManager.createTilesetDescriptor(navTilesetDescriptorOptions)
))
.acceptExpired(true)
.build();
// Start downloading the offline region
String tileRegionId = "region-233";
tileStore.loadTileRegion(
tileRegionId,
tileRegionLoadOptions,
progress -> {
int required = (int) progress.getRequiredResourceCount();
if (required > 0) {
int percentage = (int) ((progress.getCompletedResourceCount() / (double) required) * 100);
Log.d("Progress", "Download progress: " + percentage + "%");
}
},
expected -> {
if (expected.isValue()) {
Log.d("devang", "Download completed");
} else {
Log.d("devang", expected.getError() != null ? expected.getError().getMessage() : "Unknown error");
}
}
);
tileStore.getAllTileRegions(regions -> {
if (regions.isValue() && regions.getValue().size() > 0) {
Log.d("TileRegions", "Tile regions available: " + regions.getValue());
for (TileRegion region : regions.getValue()) {
Log.d("TileRegions", "Region ID: " + region.getId());
Log.d("TileRegions", "Region Metadata: " + region.getRequiredResourceCount());
}
} else {
Log.e("TileRegions", "No tile regions available or error: " + (regions.getError() != null ? regions.getError().getMessage() : "Unknown error"));
}
});
}
public void generateRoute() {
String tileStorePath = getFilesDir().getPath() + "/mapbox/tili";
try {
// Setup tile store and offline manager
// Create a TileStore instance with the specified path
// Ensure MapboxNavigation is initialized on the main thread
try {
RoutingTilesOptions routingTilesOptions = new RoutingTilesOptions.Builder()
.tileStore(tileStore)
.filePath(tileStorePath)
.tilesProfile(DirectionsCriteria.PROFILE_DRIVING)
.build();
// Create a new MapboxNavigation instance
NavigationOptions navigationOptions = new NavigationOptions.Builder(MainActivity.this)
.accessToken(getString(R.string.mapbox_access_token))
.routingTilesOptions(routingTilesOptions)
.build();
if (mapboxNavigation == null) {
mapboxNavigation = new MapboxNavigation(
navigationOptions
);
} // Initialize the new instance
Point origin = Point.fromLngLat( -6.78019511893155,62.01030535710466);
Point destination = Point.fromLngLat( -6.776550858200825,62.010792529022766);
List<Point> coordinates = Arrays.asList(origin, destination);
RouteOptions routeOptions = RouteOptions.builder()
.coordinatesList(coordinates)
.profile(DirectionsCriteria.PROFILE_DRIVING)
.computeTollCost(false)
.steps(true) // Ensure steps are included
.build();
mapboxNavigation.requestRoutes(routeOptions, new NavigationRouterCallback() {
@Override
public void onRoutesReady(@NonNull List<NavigationRoute> routes, @NonNull RouterOrigin routerOrigin) {
Log.d("Navigation", "Done to get routes: " + routes.get(0));
}
@Override
public void onFailure(@NonNull List<RouterFailure> reasons, @NonNull RouteOptions routeOptions) {
// Handle the failure case
Log.d("Navigation", "Failed to get routes: " + reasons);
for (RouterFailure reason : reasons) {
Log.e("RouterFailure", "URL: " + reason.getUrl());
Log.e("RouterFailure", "Message: " + reason.getMessage());
Log.e("RouterFailure", "Code: " + reason.getCode());
if (reason.getThrowable() != null) {
Log.e("RouterFailure", "Throwable: ", reason.getThrowable());
}
}
}
@Override
public void onCanceled(@NonNull RouteOptions routeOptions, @NonNull RouterOrigin routerOrigin) {
// Handle the case where route request was canceled
Log.d("Navigation", "Route request was canceled");
}
});
Activity
XLLucifer commentedon Jan 28, 2025
@voltazor hey sir, how you build the offline routing using naviagtion and mapbox sdk. i also working on it, i downlaoded tile succesfully but when i try to generate the offline route , this first try to generate the route from offline (onboard) router but it ended with some tile problem and try after online route
this was the logcat of error:-
[nav-native]: LatestFromServer resolved with "version: <>"
2025-01-28 14:48:55.253 11211-11279 Mapbox com.mapbox_offline I [nav-native]: Loaded PersistentConfig: {"tiles":{"latestVersions":[{"dataSet":"mapbox/driving","version":"2025_01_26-03_00_05","metadata":{"map":{"tileset_version":"2025_01_26-03_00_05"}},"discoveryTime":"2025-01-28T09:18"}]}}
2025-01-28 14:48:55.261 11211-11279 Mapbox com.mapbox_offline I [nav-native]: LatestFromConfig resolved with "version: 2025_01_26-03_00_05 discoveryTime: 2025-01-28T09:18 meta: {"map":{"tileset_version":"2025_01_26-03_00_05"}}"
2025-01-28 14:48:55.263 11211-11211 Mapbox com.mapbox_offline I [nav-native]: Tiles path = "/data/user/0/com.mapbox_offline/files/mapbox/tili"
2025-01-28 14:48:55.266 11211-11211 Mapbox com.mapbox_offline I [nav-native]: TileStore instance was passed
2025-01-28 14:48:55.267 11211-11211 Mapbox com.mapbox_offline I [nav-native]: Endpoint config = "{"host":"https://api.mapbox.com","dataSet":"mapbox/driving","version":"","token":"***...*","isFallback":false,"versionBeforeFallback":"","minDiffInDaysToConsiderServerVersion":56}"
2025-01-28 14:48:55.269 11211-11211 Mapbox com.mapbox_offline I [nav-native]: Creating navigator v.206.0.0
2025-01-28 14:48:55.270 11211-11211 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.270 11211-11211 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.274 11211-11248 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.275 11211-11248 chatty com.mapbox_offline I uid=10150(com.mapbox_offline) Worker 1 identical 2 lines
2025-01-28 14:48:55.275 11211-11248 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.275 11211-11279 Mapbox com.mapbox_offline I [nav-native]: Async version config for mapbox/driving resolved with version 2025_01_26-03_00_05 [{"map":{"tileset_version":"2025_01_26-03_00_05"}}]
2025-01-28 14:48:55.333 11211-11386 Mapbox com.mapbox_offline I [threading]: Worker 1 priority is now 4
2025-01-28 14:48:55.343 11211-11387 Mapbox com.mapbox_offline I [threading]: Worker 1 priority is now 4
2025-01-28 14:48:55.368 11211-11248 Mapbox com.mapbox_offline I [nav-native]: Requesting online route id 0: https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?access_token=****attg&geometries=polyline6&steps=true&compute_toll_cost=false
2025-01-28 14:48:55.400 11211-11279 Mapbox com.mapbox_offline I [nav-native]: Directions Service: FetchDirections request error (type 'ConnectionError'): Unable to resolve host "api.mapbox.com": No address associated with hostname
2025-01-28 14:48:55.401 11211-11279 Mapbox com.mapbox_offline E [nav-native]: OnlineRouter::getRoute req id 0 failed w/error: Unable to resolve host "api.mapbox.com": No address associated with hostname in 0.0314206 seconds
2025-01-28 14:48:55.410 11211-11248 Mapbox com.mapbox_offline I [nav-native]: Online response id 0 returned Unable to resolve host "api.mapbox.com": No address associated with hostname
2025-01-28 14:48:55.410 11211-11248 Mapbox com.mapbox_offline I [nav-native]: Onboard router: Get route request id 0: https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?access_token=****attg&geometries=polyline6&steps=true&compute_toll_cost=false
2025-01-28 14:48:55.411 11211-11248 Mapbox com.mapbox_offline I [nav-native]: getRoute: URI parsed successfully
2025-01-28 14:48:55.411 11211-11248 Mapbox com.mapbox_offline W [valhalla]: No metadata found for tiles
2025-01-28 14:48:55.491 11211-11248 Mapbox com.mapbox_offline I [nav-native]: RouteBuilder::build: Building request to onboard
2025-01-28 14:48:55.491 11211-11248 Mapbox com.mapbox_offline I [nav-native]: RouteBuilder::build: locate the coordinates within the graph
2025-01-28 14:48:55.500 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.514 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.520 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.530 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.535 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.570 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.575 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.589 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.600 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.603 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.610 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.615 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.629 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.633 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.636 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.638 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.645 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.649 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.651 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.657 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.662 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874772/0 status = Unsatisfied
2025-01-28 14:48:55.665 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.670 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/874773/0 status = Unsatisfied
2025-01-28 14:48:55.675 11211-11251 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.677 11211-11250 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876212/0 status = Unsatisfied
2025-01-28 14:48:55.683 11211-11249 Mapbox com.mapbox_offline E [nav-native]: Failed tile response: dataset mapbox/driving version 2025_01_26-03_00_05 tile = 2/876213/0 status = Unsatisfied
2025-01-28 14:48:55.704 11211-11248 Mapbox com.mapbox_offline E [nav-native]: RouteBuilder::build error: No suitable edges near location
2025-01-28 14:48:55.710 11211-11248 Mapbox com.mapbox_offline E [nav-native]: getRoute("https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?access_token=****attg&geometries=polyline6&steps=true&compute_toll_cost=false") id 0 failed: RouterException No suitable edges near location
2025-01-28 14:48:55.710 11211-11249 Mapbox com.mapbox_offline I [nav-native]: Onboard response id 0 returned No suitable edges near location
2025-01-28 14:48:55.718 11211-11211 Mapbox com.mapbox_offline W [nav-sdk]: [RouterWrapper] Route request failed with:
[RouterFailure(url=https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?geometries=polyline6&steps=true&compute_toll_cost=false&access_token=redacted, routerOrigin=com.mapbox.navigation.base.route.RouterOrigin$Offboard@2fd6700, message=Unable to resolve host "api.mapbox.com": No address associated with hostname, code=406, throwable=com.mapbox.navigation.base.internal.route.RetryableThrowable: It makes sense to retry in case of that error)]
2025-01-28 14:48:55.718 11211-11211 Navigation com.mapbox_offline D Failed to get routes: [RouterFailure(url=https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?geometries=polyline6&steps=true&compute_toll_cost=false&access_token=redacted, routerOrigin=com.mapbox.navigation.base.route.RouterOrigin$Offboard@2fd6700, message=Unable to resolve host "api.mapbox.com": No address associated with hostname, code=406, throwable=com.mapbox.navigation.base.internal.route.RetryableThrowable: It makes sense to retry in case of that error)]
2025-01-28 14:48:55.718 11211-11211 RouterFailure com.mapbox_offline E URL: https://api.mapbox.com/directions/v5/mapbox/driving/-6.7801951,62.0103054;-6.7765509,62.0107925?geometries=polyline6&steps=true&compute_toll_cost=false&access_token=redacted
2025-01-28 14:48:55.718 11211-11211 RouterFailure com.mapbox_offline E Message: Unable to resolve host "api.mapbox.com": No address associated with hostname
2025-01-28 14:48:55.718 11211-11211 RouterFailure com.mapbox_offline E Code: 406
2025-01-28 14:48:55.719 11211-11211 RouterFailure com.mapbox_offline E Throwable: (Ask Gemini)
com.mapbox.navigation.base.internal.route.RetryableThrowable: It makes sense to retry in case of that error
at com.mapbox.navigation.route.internal.RouterWrapper$getRoute$2$2$1.invokeSuspend(RouterWrapper.kt:100)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
voltazor commentedon Jan 28, 2025
@XLLucifer It seems you didn't download navigation tiles, make sure you include navigational
TilesetDescriptorinto youTileRegionLoadOptions:voltazor commentedon Jan 28, 2025
The problem I'm facing is that offline built route won't be produced until online request in the process.
It could take 20-30 seconds until request fails with the timeout, which is not an option.
XLLucifer commentedon Feb 10, 2025
@voltazor Can you help me with this offline route generate in deep? please..
this is my current code of offline route generate demo but not working and giving me upper mension error
code:-
Button btn_submit;
Button btn_tile;
private MapboxNavigation mapboxNavigation;
public void downloadTile(){
// Convert the Map to a Value object
Value metadata = fromJson(new JSONObject(metadataMap).toString()).getValue();
ResourceOptions resourceOptions = new ResourceOptions.Builder()
.accessToken(getString(R.string.mapbox_access_token))
.tileStore(tileStore)
.tileStoreUsageMode(TileStoreUsageMode.READ_AND_UPDATE)
.build();
StylePackLoadOptions stylePackLoadOptions = new StylePackLoadOptions.Builder()
.glyphsRasterizationMode(GlyphsRasterizationMode.IDEOGRAPHS_RASTERIZED_LOCALLY)
.metadata(new Value("Your metadata here"))
.build();
}
public void generateRoute() {
String tileStorePath = getFilesDir().getPath() + "/mapbox/tili";
try {
// Setup tile store and offline manager
//
} catch (Exception e) {
Log.d("DownloadError", "Failed to initialize MapboxNavigation: " + e.getMessage());
}
} catch (Exception e) {
Log.d("DownloadError", "Failed to download offline region: " + e.getMessage());
}
}
}