Addicte professional a Internet • Entusiasta dels videojocs • Creador de tecnologia
Addicte professional a Internet • Entusiasta dels videojocs • Creador de tecnologia

Com connectar-te al lloc local de Google App Engine des del teu Android

Com connectar-te al teu lloc de Google App Engine des de l’emulador d’Android en localhost sense obtenir un ConnectException!
Aquesta pàgina ha estat traduïda de l'anglès pels meus becaris d'IA, altament motivats, per a la vostra comoditat. Encara estan aprenent, així que és possible que s'hagin escapat alguns errors. Per obtenir la informació més precisa, consulteu la versió anglesa.
Inici Bloc Com connectar-te al lloc local de Google App Engine des del teu Android

Aquesta entrada és del juny de 2011, així que potser hi ha parts que ja no són vigents. Faig el que puc per mantenir-ho actualitzat!

    If you are trying, from your Android application through the Android emulator, to access an external service on the same computer (such as your own Google App Engine site) by using the host name localhost or the IP-address 127.0.0.1, you might get a java.net.ConnectException java.net.ConnectException: localhost/127.0.0.1:8888 - Connection refused error - even though you can perfectly well access the service outside the Android application.
    The reason why a ConnectException occurs is because "localhost" or "127.0.0.1" inside the Android emulator is the emulator's own loopback interface, meaning all request sent to the destination will be looped backed to the emulator and won't actually be sent to your local machine.
    To by pass this, simply replace "localhost" with the IP-address "10.0.2.2", as this is a special address towards the real local host.
    Done!

    Escrit per Special Agent Squeaky. Publicat per primera vegada el 03-06-2011. Última actualització el 03-06-2011.

    📺 Mira l'últim vídeo de Squeaky!

    Com afegir subtítols en temps real simples a la teva transmissió en directe