我一直在关注从 Android 项目创建端点后端中的教程。一切都在编译中,看起来很有希望。后端起来了。
我CloudEndpointUtils#LOCAL_ANDROID_RUN
改为true
. 但是当我尝试在真实设备(不是模拟器)上测试应用程序时,我失败了:
java.net.SocketException: failed to connect to /10.0.2.2 (port 8888) after 20000ms: isConnected failed: EHOSTUNREACH (No route to host)
因此,我查看CloudEndpointUtils
并看到该设置LOCAL_ANDROID_RUN
使true
应用程序在 中查找 DevAppServer http://10.0.2.2:8888
,这是模拟器虚拟路由器。
但我没有使用模拟器。因此,我尝试将保持此 url 的常量更改为http://127.0.0.1:8888/
但仍然没有运气。我现在失败了:
java.net.ConnectException: failed to connect to /127.0.0.1 (port 8888) after 20000ms: isConnected failed: ECONNREFUSED (Connection refused)
我认为这可能是因为我的电脑在防火墙后面,所以我禁用了它,但仍然没有。
任何建议将不胜感激。