My ASP website is running by way of the default IIS server included in Visual Studio 2015. This is accessed by the URL localhost:50544. I have to use 'Genymotion' to run an android virtual machine. Geny motion uses virtualbox so if need be I can edit the virtual machines configuration directly via virtualbox.
I'd like to visit my website from the android browser.
I've edited the android virtual machine to include a second bridged adapter and attempted to visit 10.0.2.2:50544 from within the android VM. It does not load and eventually the browser will produce a time out error. Someone's similar question mentions visiting 10.0.3.2 when specifically using genymotion. But this has the same outcome.
How may I visit the website from within the android virtual machine?
Can you try using your local IP address?
Like my IP would be: 192.169.2.9
Related
I am accessing my local server by using DNS. For this I have made changes into my etc/hosts of my PC. However I am not able to access it through my andoid devices. Is there any way to do it. Please suggest the method. I have also installed windows server 2012.
I have created a virtual host in the server and I need to access the virtual host in My andriod device also
You can use ADB pull/push, assuming your device is rooted.
HowToGeek has a pretty simple step-by-step tutorial
I am using VS 2013 to connect with the new VS2015 Android Emulator. This seems to work now and I can debug, set breakpoints etc which is all fine. (Now, I would use VS2015 but it won't deploy properly -never mind).
I am also developing the server app on my machine and using Fiddler as an http debug aid.. not an uncommon situation I am sure.
The server is running (also under debug in another instance of VS 2013) using IIS Express and I have added bindings to the applicationhost.config so the IISExpress server is visible on my LAN from other PC's and I've checked it is visible.
Try as I might I can not seem to get the Emulator to send the http requests back to my computer.
My javascript uses a servicebase to hold the url:
var serviceBase = 'http://192.168.2.4:64963/'; //'http://169.254.220.177:64963/'; //'http://10.0.2.2:64963/'; //'http://localhost:64963/';
The commented ones show the ones I have tried. None of these works.. the first is the IP of my machine on the LAN, the rest are various ones I have picked up here or the Android dev site.. I have also tried:
http://mymachinename:64963
Because I am bringing both web AND API services from this URL I have also tried a chrome browser on my real android phone (over wifi on my LAN) and this can't get to my dev machine either (where my other pc's can). So I get that it probably can't resolve the names? But really not sure where to go next? I wondered about the Hosts file on my PC but not sure if I can/should set an IP address as a host name? .. any pointers? Thanks, Brett
169.254.80.80 is the localhost loopback.
By going to Additional Tools in the VS emulator for Android (click the >> button on the right hand side) and selecting the Network tab, you will get all the information about the network connectivity.
For the localhost loopback, use the address listed under the Desktop Adapter #2. Desktop Adapter #1 should work as well, which is the IP address of your machine.
I am answering this because I have seen a lot of comments/questions about this topic and need to include some bits that it is hard to fit in the comments.. and I have solved it.
First the solution.. was to delete/replace the vsemu.vhd and vsemu.sdcard.vhd for the emulator with safe copies. This was because in my efforts to fix the problem I assume I had changed some setting in the emulator phone data. Sadly I am not sure what.
However, and this checklist may be useful to someone, before this I was led to it by the fact that because I had web services as well as API from my server URL I was able to test webpage access. This worked on pcs but failed on wifi connected android devices on my network with pc names.. as mentioned in my original question. But it wouldn't work with a numeric IP address either.
I had already added the numeric IP to the applicationhosts.config file of IISExpress, but what I hadn't done, because I thought its on the machine its referring to, was execute the
netsh http add urlacl url=http://192.168.2.1:94693/ user=everyone
command to let it all through.
Once I had done this, I was able to connect using the IP address from a phone, and this led me to discover that the Emulator had obviously got some form of problem. Replacing the VHD's fixed this and I am now communicating.
In case anyone else has this issue using the following IP's worked for me:
IP of the machine
169.254.80.80
However, do remember that VS Android emulator is running in a Hyper-v VM,
So I had to punch a hole in my firewall to allow for my application port to be reached by the emulator.
If your using Web API with visual studio 2015 and VS Android emulator this link helped me out a lot
Use 10.0.2.2, This is the loopback from emulator to your host machine.
See link:
http://developer.android.com/tools/devices/emulator.html
I was having the same issue, but none of the above answers were useful for me.
My BackEnd is a PHP SlimFramework Rest Api.
I decided to change the IP in the auto start of the Slim (was localhost:7888), I tried this: php -S 192.168.43.20:7888, and everything was working fine after I configure the calls to that ip.
I hope this may help someone...
In generic the IP you must consider is the IP of the network you are using/allocated to run the android emulator.
Very raw/rude method of finding it is by going to settings (gear symbol on right panel of emulator, not the one inside) and look for ip address. . Or by opening the ADB Logging window and it's on the top left corner.
Now in command prompt type ipconfig and match the first 3 numbers of IP and that's the network your localhost loopback.
Because in many cases we will have more than one ethernets or virtualbox host only networks are running.
Happy Coding!!
In Android emulator I encounter "Connection is lost.Host is Unresolved" error while communicating with server (creating websocket) if URL string is used. instead if IP address and port number is used it works fine.
I have configured it in host file of my ubuntu powered pc. It pings and all from the desktop.
any ideas?
Since the emulator skips the systems hosts file, change the etc/hosts file of the emulator, follow this link
http://eclecticdreams.com/blog/getting-a-hosts-file-onto-an-android-emulator
This is one of the common problems appear in android's native emulator. To resolve this, you need to restart the emulator. Or debug your application on a real device.
As an alternate, I would also like to draw your attention towards Genymotion which offers very stable, reliable and fast android emulators ranging from different device profiles and API versions.
I'm using xampp for local server in a 64-bit system. I want to test my locally hosted site to android mobile device to check the responsiveness without hosting it to any web server. How would I do that. Please answer soon
Make sure the Apache module in XAMPP is started up and your android phone is connected to your router(assuming that you are on a wireless network). Find the local IP address of the computer hosting the server. Mine, for example, is 192.168.1.142. This may or may not be similar to yours. Type that IP address into the phone's URL bar. You may need to append the port number to that too, depending on the server settings. For example, if XAMPP is running Apache on port 8080: 192.168.1.142:8080.
To obtain your local IP, it slightly varies depending on the Operating system.
For windows, go to command prompt and do the command ipconfig, it should appear as an entry there.
For linux-based systems, I believe you use the command ifconfig in terminal.
If you do not have a wireless access point, it may not be possible to visit it as the phone naturally does not have an ethernet port.
I think that's not possible. However you could find a free web host to try that out. Here is one:
http://www.host-ed.net
If you really don't want to use a web host, then try downloading the files to your phone/tablet and running them directly from phone/tablet. That will work if you have just plain html/php files. Otherwise browse google play to find a app that can run those files.
This was not available in 2014, but now you can get just a simple browser extension for testing your responsive design.
For Chrome you have e.g. 'Mobile simulator - responsive testing tool'
Simple free tool
I am developing a Wordpress site in Linux using LAMP environment. I want to test the look and feel of the site in a mobile device. I have an android device.
Is it possible to test my Linux localhost site in an android device using wifi or USB? If yes, how?
Using - Ubuntu 12.04 - XAMPP Linux 1.8.0 - Android 4.0
Note: Before you dismiss this question as possible duplicate, I checked the stackoverflow questions but nothing helped.
Open for editing!
If both your device and your LAMP setup are on the same network, no problem. Just let the URL (on Android) be the IP- adress of your Site (for example http://192.168.0.5/yourwordpresssite)
You can also use an android emulator. The emulator has access to the loopback address via 10.0.2.2.
see: http://developer.android.com/tools/devices/emulator.html#emulatornetworking