Forum Xamarin Xamarin.Android

Object reference not set to an instance of an object.

Since updating XAP within the last month I've been getting "Object reference not set to an instance of an object." errors. I've uninstalled, reinstalled and restarted Windows 8.1 machine a lot of times. I suspect the issue is related to VirtualBox Host-Only Ethernet Adapter #2. The IPv4 adapter address is and I'm unable to set it manually to When I try setting it through Network and Sharing, it tells me that my Hyper-V Virtual Ethernet Adapter is using that address. I need Hyper V for Windows simulators, and before updating XAP recently, I was able to keep Hyper-V on and run XAP no problem. Disabling the Hyper V service does not fix my issue.

More strange behavior - Every time I attempt to run one virtual device, XAP creates another VirtualBox Host-Only Ethernet Adapter #3, 4, 5, 6, 7... all of them have IPv4 address as I mention this only because it seems most people don't have so many adapters for a single virtual device. Honestly, when it worked I never opened VirtualBox to see what good network preferences look like. I attempted to set IPv4 address to, as a test, and it gives me a different error message "Failed to Initialize Device", and it does not create an additional adapter for each attempt. I think i'm on to something, but I may be going down the wrong path to fix this.

Any ideas?

I've attached the bug report.


  • UdaraAlwisUdaraAlwis LKMember ✭✭✭

    I'm also having the same exact issue, since I updated XAP to the latest version yesterday. @GregoryLutz Any luck finding a solution yet ? :(

  • GregLutz.5852GregLutz.5852 USMember
    edited October 2015

    I uninstalled Hyper-V through "Turn Windows Features on or off", and then I was able to manually set VirtualBox Host-Only Ethernet Adapter #2 to IPv4 Address: Then all of my virtual devices worked!

    When I reinstalled Hyper-V (because I require it for Windows simulators), the Android devices start crashing again. But this time it seems the IPv4 address is sticking. I get a new error "Unable to start the VM; exception follows: Xamarin.AndroidPlayer.VirtualBoxException: VBoxManage command failed. See log for further details." Log is attached.

    So while I may have solved my original problem, i'm not out of the woods yet. I've uninstalled and reinstalled XAP and VirtualBox and still get the same error in this log when Hyper-V is on.

  • PhilipGruebelePhilipGruebele USMember ✭✭

    I get this same error every time I try to create a new VM.

  • Philip,

    I was able to get passed that issue but then I hit another issue. Here's what I did.

    Open VirtualBox VM Manager.
    Open File - Preferences
    Select Network.
    Select Hot-only Networks tab.
    Select VirtualBox Host-Only Ethernet Adapter #2
    Click the edit button (screwdriver)
    Make sure the IPv4 Address is and Network Mask is
    Hit OK, OK.

    If your IPv4 address was already correctly set, then I am probably no help. Right-click the bottom blackbar of XAP and generate a bug report. For me the address was set to which is incorrect and causing the "Object Reference" error.

    Also, I was seeing multiple Adapters, like #3, #4, #5. I think one was generated for every failed attempt. I'm pretty sure you can delete them.

    If your IPv4 address for adapter #2 was also wrong and you manually set it, try to open the Preferences again and check it- did it stick? For me it was not sticking. It kept getting set back to The reason was because (I think) that address was being used by something else, specifically a Hyper-V adapter. I discovered this when I tried to manually set the IPv4 address for VirtualBox Host-Only Ethernet Adapter #2 through the Network Connections window (Network and Sharing center -> Change adapter settings). When you set it through VirtualBox they give you no warning message but Windows does tell you exactly why that IP address won't work.

    The troublesome Hyper-V adapter was not visible through my adapter settings to manually reset it, so I disabled Hyper-V through the "Turn Windows Features on and off" app window. Then my system rebooted and I was able to follow the steps above to permanently set the IPv4 adapter address for VirtualBox. All Android emulators run perfectly now. Disabling Hyper-V must have freed that specific IP address that VirtualBox requires.

    (My new issue is that now when Hyper-V is enabled again the Android Emulators "Fail to Initialize". Simply turning Hyper-V on/off is the difference now between XAP devices working or not working.)

Sign In or Register to comment.