Google TV emulator in bridge network mode - android

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

Related

Accessing the host loopback from AVD

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.

best way to connect android phone to the genymotion emulator

Since off yesterday I'm using Genymotion as Android emulator.
Now I'm running a server on the emulator that listens to connections.
I'm running the client on my real phone on the wireless network.
My client has IP 192.168.0.196 ip address and my emulator has 192.168.56.101 as Ip address.
I also tried the 10.0.3.15 as ip address but that doesn't matter.
Whats the best way to connect my phone to the genymotion emulator?
Thought changing some settings in the virtual box but everytime when genymotion starts the settings are back to default :-).
Change the second network interface in VirtualBox to "bridged". This should enable Genymotion to automatically obtain an address in your local network (you need a DHCP server)

Connecting from Android device to linux virtual machine on MAC via bluetooth

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.

Android adb forward and own bridge to reach remote server

i have a question about the adb forwarder stuff
My situation:
Ressources: 1 Windows PC where i write my code, 1 Android device (Android 2.2) connected via USB to the Windows PC, 1 Linux Server running inside a virtual Machine (VMWare) on the Windows PC
Task: the android device has to connect the virtual Machine via TCP (Port 65001)
restrictions: I am not allowed to use wlan for that (because of some issues that i can't influence). I am not able to do usb (reverse) tethering because my devices does not have the usb tethering option in the android menu (disabled by the manufacturer).
I am able to telnet the port to the virtual machine (telnet 192.168.1.2 65001) and get my data. So there are no network problems between local and virtual machine. The local ip address is 192.168.1.1.
Now i need a bridge from the incoming port 65000 to the listening Port on the virtual machine (65001). I have used the following command adb forward tcp:65000 tcp:65000 to get a tcp connection over usb from my android device to my localhost (and vice versa). As I know you can't forward with adb to a remote machine.
Now the problem is that i can't bridge from 127.0.0.1:65000 to any other port to get the full communication path. If I try to create a listening connection on 127.0.0.1:6500 i get an error with the message that the port is already bind (because of adb forward tcp:65000 tcp:65000). If the forward blocks all other connection on this port, how can i get the incoming data from the android device?
I've tried to tunnel via putty (localhost:65000 (win) -> server:65001) and I've written a little program that creates a listening server (socket) on 127.0.0.1:65000 and sends the information to 192.168.1.2:65001 via 192.168.1.1:65001.
Has anybody an idea how to solve my situation? If so please explain. Maybe this helps others too to handle the adb forwarding function.
hint: The Ports and addresses are only examples. The only fix port number is the listening port on the virtual machine

android connect to PC's localhost when debugger on mobile device

I want to debug my android application, I connect the android device to my PC using the USB cable. In my application there is a button to connect with localhost, ip for localhost is 10.0.2.2 and the port is 8080, I have read that when debugging on mobile, the ip 10.0.2.2 is the localhost for android device and not for my PC, so what changes should I make to the ip instead of 10.0.2.2? or do I have to make another change?
In this case my android device is sony ericsson xperia arc s.
Google has added support in Chrome 29 and higher to use reverse port forwarding to access a website hosted on your local development machine through the USB cable on Chrome for Android. Setup instructions can be found at the following URL:
Android Remote Debugging - Reverse Port Forwarding
Tools for Web Developers - Access Local Servers
As of desktop Chrome 30 Reverse Port Forwarding is no longer an experimental feature in Chrome. It can be accessed by typing about:inspect in the address bar of your PC, and by clicking the "Enable port forwarding" check box and clicking the "Configure port forwarding" button located to the top right of the window.
Once that is done, connect your mobile device via USB. Open Chrome on your mobile device to localhost:8000 (or whichever port you have configured on your local server).
The Reverse Port Forwarding functionality will make sure that your Android device now sees your PC's localhost.
As 10.0.2.2 is your system (pc)'s local host address (from emulator only). Actually android doesn't recognized localhost in url. so 10.0.2.2 is for that meant. Also for android device loopback address is 127.0.0.1.
Your url with 10.0.2.2 is correct. Also you can use Static IP of your system.
Just check for
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
in your application's manifest file.
EDIT:
Here you are using port 8080 so, try with adb command on your host machine.
adb forward tcp:8080 tcp:8080
Also please elaborate on this line "i want to debugger my application on my mobile".
Note:
If you are going to test on real device use your Network IP of system (PC).
For that you need to make some changes in your xampp server... Assign 1 static IP address to your system and then you need to put your xampp server in online mode. after that you can use that ip address in your android application instead of 10.0.2.2. Works fine for me as i am using my localhost with my android application.
You can share your Mac's Internet connection over Wi-Fi. Then your Android app can connect to a Servlet running on the Mac with HTTP over Wi-Fi. The steps are:
Run System Preference on Mac
Goto "Sharing" tab
Turn on "Internet Sharing"
Select "Ethernet" in the "Share your connection from" combo
Select "Wi-Fi" in the "To Computers Using" list box
Use "Wi-Fi Options..." button to configure Wi-Fi security. Now your Mac is a Wi-Fi server, and it is sharing its Ethernet Internet connection.
Configure your Android device's Wi-Fi to connect to your Mac (in Settings command)
On your Mac, goto the Network tab in System Preferences, and select Wi-Fi in list to find out the IP address of your Mac on the Wi-Fi network (for me it was 169.254.66.223)
In your Android App you can now connect to the Servlet in your Mac with "http://169.254.66.223:8080/YourServer/YourServlet"
I think you have two options
The first one is using 10.0.2.3 when you use your real android device.it works for me.
Your Second opt is creating hotspot from your pc and connect your android device to the hotspot.
Find the ip address using cmd type "ipconfig" replace localhost with the ip address.
Thanks.

Categories

Resources