6

I have a wamp server in localhost. I tried to make http request from my android app. But cannot get it right. Many said 10.0.2.2:8080 will point to localhost from emulator. So i tried to open it in web browser from emulator. i typed in url as "10.0.2.2/cifi/test.php". But emulator popped error as "net:CONNECTION_TIMED_OUT"

Need explanation: how to make my wamp server in local machine to listen 10.0.0.2:8080 from emulator's browser.

3
  • There is something you are not tell us. Is your emulator running in a Virtual Machine??
    – RiggsFolly
    Feb 4, 2014 at 21:20
  • 1
    For Genymotion, 10.0.3.2 - from: stackoverflow.com/a/20914067/2162226
    – Gene Bo
    Mar 8, 2015 at 22:45
  • Moved from answers to comments: It finally worked! I used "10.0.2.2:80/cifi/test.php". My wamp server listens only to that port. Thanks to everyone who wanted to help me!
    – IhtkaS
    Jul 16, 2020 at 9:00

3 Answers 3

4

Weirdly enough, in my case, I had to turn on and off the airplane mode to get it working.

1
  • 1
    Still worked for me in 2023 on Android 13 Aug 28, 2023 at 17:56
2

Your Wamp Server seems to be accepting only localhost connections.

Left click on wamp icon -> put online

Additionnally you should type a url http://10.0.2.2:8080/cifi/test.php instead of http://1.0.2.2/cifi/test.php

4
  • yeah i use easyphp wamp server. i started it...i can open it from my windows browser. But its not working in emulator's browser.And i nowhere mentioned i used "1.0.2.2/cifi/test.php"
    – IhtkaS
    Feb 2, 2014 at 12:17
  • You just wrote in your question : "i typed in url as "10.0.2.2/cifi/test.php". But emulator popped error as "net:CONNECTION_TIMED_OUT""
    – TheCopycat
    Feb 2, 2014 at 12:18
  • Have you tried the other thing I mentioned in my answer ? left click on wamp icon -> click Put online
    – TheCopycat
    Feb 2, 2014 at 12:32
  • @TheCopycat What is put online? It doesn't work again.
    – Dr.jacky
    Jul 2, 2014 at 11:06
0

Just got the same problem and resolved it by executing:

adb reverse tcp:8080 tcp:8080

That said, after I revoked forwarding, the host machine remained visible and all ports were working, so it is unclear how it works.

Make sure that

  • You don't have a proxy set in WIFI settings
  • If you do, then 10.0.2.2 is added to bypass without a mask
  • That you didn't make a typo, like you already did in the post with 10.0.0.2:8080

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.