So, I’m trying to figure out a way of making the offline routing a possibility in my Android app, and so far I have achieved the following:
- Loaded the gh folder generated by the graphhopper.sh
val mapsFolder = File(
val graphHopperMobile = GraphHopper().forMobile()
- Requested a GHResponse (the getGHRequest method is working perfectly fine while using a GraphHopperWeb object with the same gh folder, and is set with a ‘hike’ vehicle and has hints with elevation set to true):
val ghResponse = graphHopperWeb.route(getGHRequest(request))
So when I call the route method, I catch the following exception:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
I debugged the code, and observed that it seems to be raised in ViaRoutingTemplate.java at line 95, after calling to the ghRequest.getFavoredHeading(0)
Any ideas about the reason of the exception? The favoredHeadings is indeed empty. But why¿? Should I add anything else?
With the GraphHopperWeb is working perfectly fine, so I suppose I should add something else in the configuration of the graphHopperMobile object.