i've been trying very hard to create a route between two points(startPoint, endPoint). But i am getting the following error:

Location "Location 1" in "Stops" is unlocated. Location "Location 2" in "Stops" is unlocated. Need at least 2 valid stops. "Stops" does not contain valid input for any route.

Here is my code:

private final String routeTaskURL = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route";

protected void onCreate(Bundle savedInstanceState) {
    mMapView = (MapView) findViewById(R.id.map);
    new Thread(new Runnable() {
        public void run() {
            try {
                UserCredentials userCredentials = new UserCredentials();
                userCredentials.setUserToken(token, clientID);
                RouteTask routeTask = RouteTask.createOnlineRouteTask(routeTaskURL, userCredentials);
                RouteParameters routeParameters = routeTask.retrieveDefaultRouteTaskParameters();
                NAFeaturesAsFeature naFeatures = new NAFeaturesAsFeature();
                SimpleMarkerSymbol sms = new SimpleMarkerSymbol(
                        Color.RED, 5, SimpleMarkerSymbol.STYLE.CIRCLE);

                Point startPoint = new Point(36.793653, -119.866896);
                Point stopPoint = new Point(36.795488, -119.853345);

                Graphic graphic1 = new Graphic(startPoint, sms);
                Graphic graphic2 = new Graphic(stopPoint, sms);

                StopGraphic startPnt = new StopGraphic(graphic1);
                StopGraphic stopPnt = new StopGraphic(graphic2);

                naFeatures.setFeatures(new Graphic[] {startPnt, stopPnt});

                RouteResult mResults = routeTask.solve(routeParameters);
            } catch (Exception e) {

I've searched the internet. Many developers were/are facing this problem. I've tried all the solutions but none of them worked. I got routeTaskURL from the ArcGIS Routing Sample app. The link which is given in the documentation of ArcGIS maps gives me the 403 error if i open it in the browser.

Note: "token" and "clientID" is declared in the first step and they both are taken from the ArcGIS developers console where i registered my application.

  • Have you tested the route network in ArcMap? I think the network isn't connected properly.
    – Stefan
    Jan 29, 2016 at 15:29
  • @Stefan I'm sorry i don't know what route network is and how to use it. I believe it is for ArcGIS Desktop. Can you please elaborate? Any link for the guide? Jan 29, 2016 at 16:07

2 Answers 2


It will work if you switch your X and Y values. See https://stackoverflow.com/a/35139941/720773 for a full description of what is happening.

  • Thanks you solved my problem. But can you look at my updated code and see why route is not displaying on map. I've added all the necessary graphic layers. Code Link: paste.ubuntu.com/14856322 Feb 2, 2016 at 10:17

I don't think you are allowed to use http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route

In a production app.

Esri has paid options for directions services to use instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.