com.google.api.client.googleapis.json.GoogleJsonResponseException:404找不到谷歌应用引擎连接的android项目

时间:2013-07-19 07:44:43

标签: android google-app-engine

我是Google app引擎连接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)

这是什么错误以及我为什么会这样做。请帮我找到解决方案。

2 个答案:

答案 0 :(得分:1)

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

由于您的堆栈跟踪表明您正在尝试访问端点,因此404响应的几个可能原因是:

  • Android应用程序使用的网址不正确
  • 尚未部署端点
  • 端点不可见
  • 端点和类未正确注释

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

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

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

答案 1 :(得分:0)

检查此问题的答案here

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