We have a continuous integration server as shown in the image and have build agents which are connected to a Android virtual device hosted in the emulator host.
The port of each corresponding emulator is forwarded to the build agent and from the build agent the android virtual device is connected via adb. So each build agent is connected to one virtual device.
I am trying to connect to the host loop back interface from the AVD device with the IP address 10.0.2.2 as described in here.
But the issue is that 10.0.2.2 is not the loop back of the build agent. Instead it is connected to the loop back on the emulator host.
Is there some way to connect it to the loop back of the build agent instead of the emulator host from the android virtual device ?
It is not possible to access it via 10.0.2.2. Instead I had to use the ip address of the build agent to get it working.
Related
I am trying to implement an Android application in Windows 7 using Eclipse. I am trying to connect the Android simulator to the local test server in my company, but for some reason, it cannot connect to the test server.
If there is any settings or configurations for this, please let me know.
I have tried to do the same from a MAC machine using iPhone emulator and I am facing the same problem. How would this emulator connect to the local servers in my company as currently it all goes to live servers? What configurations are required to be done on the simulators, and how?
If I try to connect to the test server from normal Windows machine browser, I am able to successfully connect to it through the web browser; but when I try to do the same from the Android emulator browser, it cannot connect to it.
The emulator points to the live network and not the local network in my company. This is strange and I know that I need to do some settings for it, but I am not sure where these settings are done and how.
If accessing local computer:
http://localhost:8080/MyLocalServer.html // URL to use in computer browser
http://10.0.2.2:8080/MyLocalServere.html // URL to use in emulator browser
Also try using a local IP to connect to any local servers. Do not use host names.
Dont:
http://mylocalserver.org/
Do:
http://192.168.1.125:portnumber
You have to set up IP-based hosts instead of name-based.
Emulator its - VM. This use virtual network connection. I think you need before chech this connection (this connection may bee stay as NAT, Breedge, Native IP adress, Proxy).
Since you do not work iPhone emulator, most likely you, IP adress virtual network connectionб which uses Emulator, does not match the address area of the local network, and routing occurs
This may help you...
Taken from the android docs:
If you need to refer to your host computer's localhost, such as when you want the emulator client to contact a server running on the same host, use the alias 10.0.2.2 to refer to the host computer's loopback interface. From the emulator's perspective, localhost (127.0.0.1) refers to its own loopback interface.
http://developer.android.com/guide/faq/commontasks.html#localhostalias
Let me explain the situation:
Web application is running on ubuntu virtual machine (VirtualBox). I can
ping it from my mac. Vm's ip address is 192.168.56.100.
Android device is connected to a mac via bluetooth internet sharing.
I can ping from android to mac. mac's ip address 192.168.65.1.
I can access web application from android if its are running directly on mac (MAMP).
The problem: I need to be able to ping from android device to virtual machine.
Don't know what is the best ways to achieve that. I believe i have to set up some sort of network
bridge or IP forwarding or port forwarding or routing rule to virtual machine.
This is my virtual box network settings:
http://imageshack.us/a/img42/2475/9ufb.png
http://imageshack.us/a/img24/2319/w4nh.png
Tried to make a bridge network adapter to Bluetooth PAN on virtual box setting
Didn't work.
Any help or advice would be appreciated.
Thank you.
I try to deploy a worklight application into my android device (HTC Desire), without any hope I get the following error:-
Request timeout for [ANDROID IP :8080/console/apps/services
Default options: on failure timed out for
http://ANDROIDIP:8080/console/apps/services...
Make sure the host address is available to the app (especially relevant for android and iphone apps]
I find my android IP address via whatip.com and I configure my application descriptor xml file with it.
it works with android emulator when I use the following
<worklightServerRootURL>http://10.0.2.2:8080</worklightServerRootURL>
but not with the mobile device
any advice?
worklightServerRootURL should point to the public IP address of the host machine, not to the device IP.
The device and Worklight Server must be in the same network (public Internet, wifi...).
10.0.2.2 is a special address that only works on the android emulator. On the emulator, it is routed to the host where the emulator is running. On an actual device, this address won't be routed anywhere.
As Idan said, the Worklight server must be reachable from the Android device. This usually means that either the Worklight server has an address that is reachable from the internet, or that the android device has a wifi connection to the LAN where the worklight server is running.
Assuming that you are trying to test using the test server in worklight studio, first determine your computer's IP address. If you are behind a NAT router, whatip.com returns the IP of the router, not of your computer. Use ifconfig (ipconfig on windows) at a command line to determine your computer's IP address. Your computer may have several IP addresses. It is important that you choose the ones that corresponds to the LAN where you will be connecting your Android device. If you are unsure which one this is, you may need to look at your router's configuration. Next, verify that your computer's firewall has port 8080 open. Then connect your android device via wifi to the same LAN as your computer.
To verify that your device can reach the worklight server, try opening the worklight console in the phone's browser. (http://[IP of computer]:8080/console) Once that works, you should be able to use the same IP in the worklightServerRootURL to build the app so that it will work on that device.
I have a normal simple java program running as a server, waiting for a client to connect with TCP.
On another eclipse project, i'm building an android application. That application has to contact the java program running on the host machine to receive a message.
I can't simply use "localhost" to contact the server becouse, supposedly, the emulator runs behind a virtual router and i'll be accessing the "phone"'s network instead of the host machine's network.
So, what ip should I use to contact the host development machine?
The machine is a linux running on a VirtualBox with an Ip of 10.0.0.5.
I've tried to use that ip on the emulator but even so, I can't establish a connection.
I think you want 10.0.2.2. Check out the Android Emulator Networking documentation:
https://developer.android.com/studio/run/emulator-networking.html
I believe you need to enable port forwarding in order to use any kind of network connection in the emulator. You can do this with the adb tool. Check the Android Developer Guides for details.
I want to connect to my app running in the emulator from another machine on my local network. The ip assigned to emulator is 10.0.2.15 while my host machine has ip 192.168.1.* . Is there any way to run the emulator in bridge mode such that it gets an ip in the range 192.168.1.* ?
The Android Emulator has a virtual router connecting it to the network. You can use the redir command to setup network connections. See this article:
http://developer.android.com/guide/developing/devices/emulator.html#emulatornetworking