Is it possible t make two android emulator on eclipse communicate from two differents machines which are connected with a fast ethernet link ?
Thanks for reply
Yes. The outgoing side just works, but the incoming side (whichever one is receiving the connection) is a bit more complicated. You would set up an emulator or adb port forward, but that only makes a port on the loopback interface ("localhost" ie 127.0.0.1) of the machine hosting that emulator ring through to the the emulator android device it is hosting. It probably will not accept connections on the external network. So to get around that, you can ssh from one hosting machine into the other, and set up an ssh port forward so a port on the loopback of the connecting machine forwards to a port on the loopback of the receiving machine and then forwards into its emulator...
First, android emulators are independent of Eclipse. That is, you don't need Eclipse to run the emulators:
C:\android-sdk-windows\tools\emulator.exe -avd <AVD name>
So the answer to your question applies to both scenarios: emulator running from Eclipse or running without Eclipse at all.
As for your question: Yes, it is possible. The android emulator is a basically a heavily customized linux box.
From the command line, type: adb shell and you will find yourself in a familiar linux shell. :)
Then ping the IP address of the other emulator and see how communication flows.
Related
I have set up a virtual machine running an Android 4.4 system on VirtualBox, in a Windows 7 system, for convenience in testing an Android app I am trying to develop. What last remains, is to be able to make the guest Android OS look like it's connected to the host via USB, to be able to use USB Debugging. Is there a way to achieve that?
EDIT: By "convenience" I mean I do not have a good enough physical device at my hands at the moment, and my processor happens not to support VT-x, in which case I could just use an AVD with Android Studio. Therefore, the VirtualBox choice is the next best thing I got, until I get a new device on my hands. What has priority at the moment is to create the app's utility, looks will be taken care of later on.
If your Android system is rooted you can install Wifi ADB (or some similar application) through Android Play store and debug over TCP.
The steps can be simply:
Install Wifi ADB (from https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es)
Execute and start service (Bettle will go to green)
Open Command line in Windows 7 machine
Run the connection command, for example:
adb connect 192.168.125.232
Test device connection with
adb devices
Enjoy testing your application!
I'm trying to install OBDSim on Win7 but am running into some trouble. My end goal is to run OBDSim as a bluetooth ELM327 OBDII Simulator and connect to it using the Torque app on my Android device.
I watched a video on youtube (http://www.youtube.com/watch?v=-dMjo5ySbcc) that demos exactly what I am trying to simulate but it was running Lubuntu 12.04.
I've been reading through posts on mp3car and other posts on stackoverflow over the last week but I'm still a little lost. I'm not sure exactly how obdsim makes use of com0com to get my bluetooth dongle to connect with Torque on my phone. Heres what I have so far:
I've paired my Android device to my computer
I've installed com0com and have a CNCA0 <-> COM5 pair set up.
I set the incoming COM Port to be COM5
I'm running the obdsimwindows-2011-06-11 build as suggested (Although
-b is giving an invalid option.. Also bluetooth isn't listed under --help either. Does this version support bt??)
I am able to launch the gui successfully using 'obdsim.exe -g gui_fltk -w COM5'
Torque still isn't being able to connect and read from the simulator.
I think theres one more big step I'm missing, but I'm not sure what it is. I found this correspondence (http://icculus.org/pipermail/obdgpslogger/2012-January/000122.html) which sort of resembles where I'm at, but I don't know how to the bind and sdptool commands translate to windows (that was a linux problem).
Has anyone tried to set up OBDSim on Windows and connected to their Android device via bluetooth successfully?
Thanks!
The man page, right under the bluetooth heading, says that bluetooth is not supported in windows.
http://icculus.org/obdgpslogger/manpages/render/obdsim.txt
One more answer from stackoverflow which worked perfectly for us.
https://stackoverflow.com/a/25763606/739262
I tried it on Win7 and it works with the -w switch ...trying to make it work on VM win7 in a Mac host still having issues.
FYI it also works thru a tcp socket I have a win7 VM where I run OBDSim and thru a redirector tcp to COM make it available from outside the VM it works ... bunch of tools to do the redirecting but none worked 4 me ended up writing my own simple socket redirector to COM in Win7. Tested it on the Mac thru a basic iOS App I wrote on the iOS simulator.
Okay so here is the background of this problem. I commute a lot on the train and build a lot of PHP web apps optimized for mobile devices. I would like to develop code on a netbook (Running Ubuntu Server) with no GUI. All development done using Vim directly on the netbook.
I would like to connect up my Nexus 4 to the netbook via USB and "connect" to the netbooks web server in the chrome browser. I can only use USB for this since I won't be having any reliable internet access.
I understand that using adb from the Android SDK, you can forward a port from the netbook to the phone. However, I need to do it the other way around.
For example:
Run a web server on the netbook on port 4000
Connect phone via USB
Somehow forward port 4000 on the phone to port 4000 on the netbook
Open chrome browser on phone and go to localhost:4000.
I am aware of the "reverse port forwarding" method that is described in the Google docs at https://developers.google.com/chrome-developer-tools/docs/remote-debugging. However, this requires an installation of chrome on the netbook. I don't want to have to install an entire GUI just for this.
Update
With regards to the above, I have found https://groups.google.com/a/chromium.org/forum/m/#!topic/chromium-reviews/7mE61hDcFdA. Does this mean I could install Chrome on the netbook (even though I don't have a GUI) and port forward via CLI?
An APP might do the job here. If you know some java you might be able to pull it off. Basicly you tunnel a connection through adb, then use an app as proxy and a small program on the computer. There might be an easier way though
Is there a way to bridge the network device of the Android emulator onto the host machine?
I have seen these instructions, but they are really old, the file names have changed, and my attempts to translate them to the current emulator haven't worked. There are a few other similar examples around, but they're all from 2007-2008. I must admit, my Linux- and especially networking-fu are not strong. I could not get a second networking device (eth1) to show up in the emulator.
The reason I want to have the network device appear as a device on the host machine is that I need to be able to connect to the android device from a remote computer (not the host), through rsh (which I've been able to do, as shown in my instructions here), and then use ssh from within to connect to another remote computer. I can get in to rsh, but I can not ssh out (or ping the remote computer). (I've been provided with an image with rshd on it, and this works fine on an actual phone, but the emulator's network devices being hidden is causing problems)
If an eth1 could be created and bridged, that would be great. I'm also open to bridging eth0 (but I'd want to change the IP to 172.x.x.x to be on the same subnet as the remote computers)
Thanks. I'll try to clarify anything if you ask.
1) Download the LiveAndroid iso from the LiveAndroid Project on google code. Or alternatively, download Android-x86 iso from here. 2) Boot it as a virtual machine with VMWare or VirtualBox. 3) Configure your virtual machine to use Bridge networking, as you would per any regular virtual machine. 4) Install Android SDK the other tools like adb onto your Host computer. Connect using adb to the virtual machine as if it were a real android hardware device.
Note: LiveAndroid is an EE-PC based virtual machine. It thinks its running on EE-PC hardware. So there will be no QEMU-based android emulator running. The network bridging will be performed by the Host-OS drivers provided by your chosen virtualization software.
I am trying to communicate between two android emulators for communication , thus I am trying to forward port X to port Y on 127.0.0.1 where port X is the port I am transmitting too and Y is the one I am receiving . Is this possible and if so how do I forward the local ports?
The socat tool is useful for this:
socat TCP-LISTEN:Y TCP:localhost:X
(assuming you're in Linux)
Googling revealed portfwd. Although it is quite ancient, it seems to do what you describe. Other results suggest that iptables may be able to do what you want as well, but there were no succinct guides that I could find.
I would imagine it's easier to use emulator port redirections, either via the AVD console or the adb command.