1

我是 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)

这是什么错误以及为什么我得到这个。请帮我找到解决方案。

4

2 回答 2

1

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

由于您的堆栈跟踪表明您正在尝试到达端点,因此此 404 响应的一些可能原因是:

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

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

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

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

于 2016-03-11T20:56:34.787 回答
0

在此处查看有关此问题的答案

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

于 2014-03-02T00:24:18.073 回答