Document Navigation SDK for Android Guides Error Codes Route Calculation Error Codes

Route Calculation Error Codes

When a route calculation fails, the SDK calls the callback interface below. You can retrieve the error code from the AMapCalcRouteResult object's errorCode field. The following table provides detailed explanations for each error code. Additionally, the errorDetail and errorDescription fields may contain supplementary information. When reporting issues, please provide both of these values.

/**
 * Route calculation failure callback. This is triggered when a route calculation fails,
 * including during initial route calculation, rerouting due to off-route navigation,
 * user changes to the route calculation strategy, or waypoint changes.
 * The route calculation result can be obtained via {@link com.amap.api.navi.model.AMapCalcRouteResult}.
 * Use CalcRouteResult to get the error code, route calculation type, and route ID.
 *
 * @param routeResult {@link com.amap.api.navi.model.AMapCalcRouteResult}
 * @since 6.1.0
 */
void onCalculateRouteFailure(AMapCalcRouteResult routeResult);

Error Code Reference

Error Code

Description

Troubleshooting

2

Network failure

Check network connectivity and try again later.

3

Invalid origin

Ensure the origin is a valid coordinate point within mainland China and that the latitude/longitude format is correct.

4

Protocol parsing error

Submit the origin, destination, waypoints, and route calculation strategy to us via the ticket system.

6

Invalid destination

Ensure the destination is a valid coordinate point within mainland China and that the latitude/longitude format is correct.

7

Server-side encoding error

Submit the origin, destination, waypoints, and route calculation strategy to us via the ticket system.

8

Insufficient preview data

Submit the origin, destination, waypoints, and route calculation strategy to us via the ticket system.

9

Data format error

Submit the origin, destination, waypoints, and route calculation strategy to us via the ticket system.

10

No road found near the origin

Adjust the origin location.

11

No road found near the destination

Adjust the destination location.

12

No road found near a waypoint

Adjust the waypoint location.

13

Invalid or expired API key

Verify the API key configuration.

17

Request quota exceeded

Submit the API key, errorDetail, and errorDescription to us via the ticket system.

18

Invalid request parameter

Check for any exception output. Submit the API key, errorDetail, and errorDescription to us via the ticket system.

19

Unknown error (possibly due to the network being unable to access the external internet)

Check for any exception output. Submit the API key, errorDetail, and errorDescription to us via the ticket system.

20

Distance between origin, destination, or waypoints is too long

This error typically occurs during truck or cycling/walking route calculations when the straight-line distance between the origin, waypoints, and destination is too long. Submit the origin, destination, waypoints, and NSError information to us via the ticket system.

21

Invalid waypoint

Ensure the waypoint is a valid coordinate point within mainland China and that the latitude/longitude format is correct.

22

MD5 security code verification failed

Verify that the SHA1 and package name bound to the API key match those in the SDK package.

23

Request frequency exceeded

Check for any exception output. Submit the API key, errorDetail, and errorDescription to us via the ticket system.

24

API key platform mismatch

Verify the API key configuration. For example, an API key created for the JavaScript API cannot be used with web service interfaces.

25

Route planning point outside mainland China

Verify that the origin and destination are correct and that the latitude and longitude values are not reversed.

26

Route calculation failed (distance too long)

Verify that the origin and destination are correct and that the latitude and longitude values are not reversed.

28

Missing valid navigation path

Verify that route calculation was successful before starting navigation.

29

Route calculation type mismatch

Verify that the current route calculation type (driving/cycling/walking) matches the current navigation mode.

2999

New independent route calculation in progress

When two consecutive route calculations are triggered, the first one is cancelled and returns error code 2999. Ensure that the previous route calculation completes before triggering the next one.