I have a Vagrant VirtualBox (Scotchbox) on my Mac Mini (Yosemite) and a test server inside the box (LAMP) running a website on it. From the iOS Simular and regular browsers I can reach it well.
From my Android Virtual Device (emulator64-arm, Android 4.2.2, native browser) on the same OSX (Yosemite) host I only get unformatted text and links, no image. - see below. cannot inspect elements inside the virtual device so no help there. When I load the site using the host name site.dev as stored in etc/hosts on the host (OSX) I get nothing at all. Only by ip at least I can load a broken site.
That is with this Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
end
I changed from a private to public network to see if I could load a whole site from my Virtual Device.This is the Vagrantfile after the small tweak:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "public_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
end
When I ran vagrant reload
with public_network
instead of private_network
I see
vagrant@127.0.0.1's password:password
==> default: Checking if box 'scotch/box' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) en1: Wi-Fi (AirPort)
2) en2: Thunderbolt 1
3) en0: Ethernet
4) bridge0
5) p2p0
6) awdl0
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
default: Which interface should the network bridge to? 1
I picked one being on a wireless network.. Not sure if that was the best choice .. But then I was told:
NFS requires a host-only network to be created.
Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work.
Any ideas why I cannot just load the site on my Virtual Device from Android Studio using the initial Vagrantfile setup? Localhost loaded just fine on 10.0.2.2
. How to fix this issue?