Google Play 服务的各种错误码速查

问题背景

接入Google Play服务时,难免遇到各种错误,比如

通常我们可以用result.getDebugMessage()来获取错误描述,result.getErrorCode来获取错误码。

然后对比官方文档来查看详细错误信息。

官方文档

https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes.html

错误参考

Code Const Desc
-1 SUCCESS_CACHE The operation was successful, but was used the device's cache.
0 SUCCESS The operation was successful.
2 SERVICE_VERSION_UPDATE_REQUIRED This constant is deprecated. This case handled during connection, not during API requests. No results should be returned with this status code.
3 SERVICE_DISABLED This constant is deprecated. This case handled during connection, not during API requests. No results should be returned with this status code.
4 SIGN_IN_REQUIRED The client attempted to connect to the service but the user is not signed in.
5 INVALID_ACCOUNT The client attempted to connect to the service with an invalid account name specified.
6 RESOLUTION_REQUIRED Completing the operation requires some form of resolution.
7 NETWORK_ERROR A network error occurred.
8 INTERNAL_ERROR An internal error occurred.
10 DEVELOPER_ERROR The application is misconfigured.
13 ERROR The operation failed with no more detailed information.
14 INTERRUPTED A blocking call was interrupted while waiting and did not run to completion.
15 TIMEOUT Timed out while awaiting the result.
16 CANCELED The result was canceled either due to client disconnect or cancel().
17 API_NOT_CONNECTED The client attempted to call a method from an API that failed to connect.