AsafK AsafK - 3 months ago 16
Android Question

Google App Engine with Android - testing endpoints on real device

i've been following the tutorial in Creating an Endpoints Backend from an Android Project. Everything is compiling and looks promising. The backend is up, i changed CloudEndpointUtils#LOCAL_ANDROID_RUN to 'true'. but when i try to test the app on a real device (not emulator) im failing on -


java.net.SocketException: failed to connect to /10.0.2.2 (port 8888) after 20000ms: isConnected failed: EHOSTUNREACH (No route to host)


So i looked at CloudEndpointUtils and saw that setting LOCAL_ANDROID_RUN to 'true' makes the app look for DevAppServer in
http://10.0.2.2:8888
, which is the emulator virtual router.
but im not using the emulator. so i tried to change the constant holding this url to
http://127.0.0.1:8888/
but still no luck. im now failing on -


java.net.ConnectException: failed to connect to /127.0.0.1 (port 8888) after 20000ms: isConnected failed: ECONNREFUSED (Connection refused)


I thought it might be because my PC is behind a firewall, so i disabled it, but still nothing.

any suggestion would be appreciated.

Answer

Add the

--address="0.0.0.0" 

as the app engine server address parameter to accept from all incoming connections.