Document Location SDK for Android Guides Utility Tools Error Codes

Error Codes

When a location or geofencing request fails, the callback returns an error code. Use AMapLocation.getErrorCode() to retrieve the error code.

Error Code Reference

Code

Description

Troubleshooting

0

Location successful.

Perform business logic after confirming a successful location in the callback.

1

One or more required parameters are null (e.g., context).

Verify that all parameters passed to the location request are non-null.

2

Location failed: only a single Wi-Fi access point was detected, with no cell tower information.

Retry the request.

3

The request parameters obtained are empty, possibly due to an exception during retrieval.

Check the network connection thoroughly; the request may have been tampered with.

4

An exception occurred while requesting the server, often caused by poor network conditions or a broken link.

Check that the device has a stable network connection. Verify the network timeout setting (the default of 30 seconds is recommended).

5

The request was hijacked, and the location result could not be parsed.

Retry later, or check the network link for anomalies.

6

The location service returned a failure.

Retrieve the error details using getLocationDetail() .

7

Key authentication failed.

Verify that the SHA1 value bound to the key matches the APK signing SHA1 value. 

8

General Android exception error.

Send the error details (obtained via getLocationDetail()) to us through the ticket system.

9

An exception occurred during location initialization.

Restart the location process.

10

The location client failed to start.

Check that the APSService location service is declared in the AndroidManifest.xml file.

11

Incorrect cell tower information during location.

Check if a SIM card is installed. The device may be connected to a fake base station.

12

Missing location permission.

Enable the location permission for the app in the device settings.

13

Location failed: no Wi-Fi list or cell tower information available, and GPS is currently unavailable.

Turn on the device's Wi-Fi, insert a working SIM card, or check if GPS is enabled. If all of the above are correct, verify that the app has been granted location permission.

14

GPS location failed due to poor GPS signal.

Move the device to an open outdoor area and try again.

15

Location failed because the result was simulated.

If you want to allow simulated locations, use AMapLocationClientOption.setMockEnable(true).

16

No available geofences were found under the current POI or administrative district search criteria.

Adjust the search criteria and try again (e.g., change the POI keyword, POI type, surrounding area, or administrative district keyword).

18

Location failed: Wi-Fi is turned off and the device is in Airplane mode.

Turn off Airplane mode and enable Wi-Fi.

19

Location failed: no SIM card inserted and Wi-Fi is turned off.

Insert a SIM card and enable Wi-Fi.

20

Approximate location error: location failed when the app's location permission is set to "Approximate location".

Retrieve detailed error information using getErrorInfo().

v1.x Location SDK Error Code Reference

The following table lists error codes for the v1.x version of the Location SDK (check the version number in the JAR file name or use the getVersion() method). Due to lower stability, we recommend upgrading to the latest version as soon as possible.

Code

Description

0

Success, result returned.

21

I/O operation exception.

22

Connection exception.

23

Connection timeout.

24

Invalid parameter.

25

Null pointer exception.

26

URL exception.

27

Unknown host.

28

Failed to connect to server.

29

Communication protocol parsing error.

30

HTTP connection failed.

31

Unknown error.

32

Key authentication failed. Verify that the SHA1 value and package name bound to the key match the APK information. 

33

No location permission granted.

34

Unable to obtain city information.

35

The current IP address has exceeded the request quota.