我从创建一组AppEngine端点的标准Google教程开始。无论是在本地还是部署到生产环境中,该教程都非常有效。我使用的是Eclipse Kepler和标准的Google Eclipse插件。
我已经向我的AppEngine后端添加了一些新的端点API。我在本地测试了新的API,它们工作正常。我的新API是非常简单的数据存储对象。
接下来,我将更新后的AppEngine后端部署到生产环境中。谷歌AppEngine日志和仪表板告诉我,我的更新版本已上传并成功安装。API发现URL显示了我的新API和以前的API。之前的API仍然有效。新的API不起作用。有且只有一个应用程序版本。我是在Android模拟器上测试的。
我到处寻找答案。
我收到的错误如下:
09-04 18:12:20.450: D/CloudSync(703): syncAll(): IOException attempting to insert entity via AppEngine
09-04 18:12:20.450: W/System.err(703): java.net.ConnectException: failed to connect to /10.0.2.2 (port 8888) after 20000ms: isConnected failed: ECONNREFUSED (Connection refused)
09-04 18:12:20.481: W/System.err(703): at libcore.io.IoBridge.isConnected(IoBridge.java:214)
09-04 18:12:20.481: W/System.err(703): at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
09-04 18:12:20.481: W/System.err(703): at libcore.io.IoBridge.connect(IoBridge.java:112)
09-04 18:12:20.481: W/System.err(703): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
09-04 18:12:20.491: W/System.err(703): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
09-04 18:12:20.491: W/System.err(703): at java.net.Socket.connect(Socket.java:842)
09-04 18:12:20.491: W/System.err(703): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
09-04 18:12:20.491: W/System.err(703): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
09-04 18:12:20.491: W/System.err(703): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
09-04 18:12:20.521: W/System.err(703): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
09-04 18:12:20.531: W/System.err(703): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
09-04 18:12:20.531: W/System.err(703): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
09-04 18:12:20.531: W/System.err(703): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
09-04 18:12:20.561: W/System.err(703): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
09-04 18:12:20.571: W/System.err(703): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
09-04 18:12:20.571: W/System.err(703): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
09-04 18:12:20.581: W/System.err(703): at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)
09-04 18:12:20.581: W/System.err(703): at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:77)
09-04 18:12:20.611: W/System.err(703): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:960)
09-04 18:12:20.621: W/System.err(703): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
09-04 18:12:20.621: W/System.err(703): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
09-04 18:12:20.631: W/System.err(703): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
看起来我肯定漏掉了一些简单的东西。感谢您的建议。
更新:
我可以在Google API Explorer中查看、浏览和成功测试我的新/更新的API。因此,这似乎是Android应用程序构建的问题。
发布于 2013-09-11 05:36:48
我在今年(2013) 3月和4月的时间框架内发现了许多非常相似但并不完全相同的问题报告。回顾GPE的发行说明,我看到谷歌在5月份之前解决了大多数问题。我比较了我的Eclipse GPE和SDK版本,发现它们来自三月的时间框架。因此,我做了以下工作。
1) a full update of all installed Eclipse plug-ins including the Google plug-ins
2) removed all generated Google Cloud Endpoint code from both the AppEngine project and the Android App project
3) updated the AppEngine project version number found in the appengine-web.xml
4) re-generated all of the Google Cloud Endpoint libraries
5) deployed the updated AppEngine
6) used the AppEngine Dashboard to set the new Default version to match the above
7) tested and verified the updated Endpoint APIs from the Google API Explorer and using the Datastore Viewer
8) Double checked that the following was set to false:
public class CloudEndpointUtils {
...
protected static final boolean LOCAL_ANDROID_RUN = false;
...
}
8) Ran the updated Android application from the emulator (making sure that the emulator Run Configuration was set to a target using Google API 15+ and the Additional Emulator command line arguments was set to "-dns-server 8.8.8.8" (without the double quotes) -- this is the Google DNS service)
9) verified that the Android application could save data to a new set of endpoints with no log errors, and the new stored entities are present confirmed through the Datastore Viewer.
我验证了无论是打开/关闭本地防火墙还是打开/关闭防病毒软件,都没有区别。
问题解决了。我相信我只需要了解最新的软件更新。
https://stackoverflow.com/questions/18626356
复制