【问题标题】:com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found in google app engine connected android projectcom.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found in google app engine connected android project
【发布时间】:2013-07-19 07:44:42
【问题描述】:

我是 Google 应用引擎连接的 android 项目的新手。当我尝试创建和运行项目时,我遇到了异常

07-19 07:22:18.437: W/System.err(1854): com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
07-19 07:22:18.437: W/System.err(1854): Not Found
07-19 07:22:18.447: W/System.err(1854):     at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:111)
07-19 07:22:18.447: W/System.err(1854):     at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:38)
07-19 07:22:18.447: W/System.err(1854):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
07-19 07:22:18.447: W/System.err(1854):     at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1042)
07-19 07:22:18.447: W/System.err(1854):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
07-19 07:22:18.457: W/System.err(1854):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
07-19 07:22:18.457: W/System.err(1854):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
07-19 07:22:18.457: W/System.err(1854):     at com.example.endpointdemoproject.MainActivity$EndpointsTask.doInBackground(MainActivity.java:55)
07-19 07:22:18.457: W/System.err(1854):     at com.example.endpointdemoproject.MainActivity$EndpointsTask.doInBackground(MainActivity.java:1)
07-19 07:22:18.457: W/System.err(1854):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-19 07:22:18.467: W/System.err(1854):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-19 07:22:18.467: W/System.err(1854):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-19 07:22:18.467: W/System.err(1854):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-19 07:22:18.467: W/System.err(1854):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-19 07:22:18.477: W/System.err(1854):     at java.lang.Thread.run(Thread.java:856)

这是什么错误以及为什么会出现此错误。请帮助我找到解决方案。

【问题讨论】:

  • 嘿@ssl,你得到这个答案了吗?我遇到了同样的问题。几乎相同的事实。
  • 即使我也有同样的问题 :(

标签: android google-app-engine


【解决方案1】:

Android 应用程序正在接收的 HTTP 响应是 404。这通常意味着服务器收到了请求但找不到请求的资源或者它不存在。

由于您的堆栈跟踪表明您正试图到达一个端点,这个 404 响应的几个可能原因是:

  • Android 应用使用的 URL 不正确
  • 端点尚未部署
  • 端点不可见
  • 端点和类没有正确注释

仔细检查 URL 后,您应该能够通过检查https://developers.google.com/apis-explorer/?base=https://[YOUR-PROJECT-ID].appspot.com/_ah/api#p/ 的 API Explorer 来查看已部署和公开的端点,正如 @easycheese 所提到的。 如果您在此处未看到您尝试访问的端点,请通过重新部署您的应用程序确认它实际上已部署。

如果您已确认已部署但仍无法在 API Explorer 中看到它,请查看端点方法代码以确保正确的注释到位。该类必须具有@Api 注释,以便公开其公共非静态、非桥接方法。此外,@ApiResourceProperty(ignored = AnnotationBoolean.TRUE) 可用于防止端点被访问。如果您要公开该方法,请确保注释存在。

一旦您通过 API Explorer 确认了一个可访问的端点,您就应该能够更好地测试您的 Android 应用程序的连接性。

【讨论】:

    【解决方案2】:

    查看这个问题的答案here

    您很可能从未正确部署过您的项目。尝试重新部署它或检查https://developers.google.com/apis-explorer/?base=https://[YOUR_PROJECT_ID].appspot.com/_ah/api#p/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-29
      • 2013-11-09
      • 1970-01-01
      • 2019-12-26
      • 2019-04-06
      • 1970-01-01
      • 2013-05-07
      相关资源
      最近更新 更多