androidandroid-emulatoradbvirtualboxandroid-x86

Suppress launching emulator using Android within VirtualBox


Description

I am running Android-x86 7.1 using VirtualBox. I want to adb connect from the host to the guest. I experience a very random behavior when it comes to adb devices. As soon as the virtual machine runs there is a chance that an emulator called emulator-5554 appears. Sometimes it is listed, sometimes it is not. Connecting to the device using adb connect 127.0.0.1 results in the following:

adb devices -l shows that the emulator is coming from the virtual machine: device product:android_x86_64 model:VirtualBox device:x86_64 transport_id:1

Problem

Even though emulator-5554 works fine and I can communicate with the virtual machine I cannot rely on this due to I want to automate things. 127.0.0.1 is given by my VirtualBox network configuration. The name emulator-5554 seems random and might change. Therefore I need to use adb connect 127.0.0.1 which is not possible when the emulator is online.

VirtualBox configuration

Network settings

USB settings

Current approach

The current approach is represented by all of the current settings that I have made which still lead to a randomly appearing emulator-5554.

Using adb kill-server & adb -s emulator-5554 emu kill didn't have any effect aswell.

Question

Is there anything I can do to stop emulator-5554 from starting up and therefore showing up in my adb devices?


Solution

  • I could solve the problem by using the following port forwarding rules.

    So the difference to my first approach is leaving blank both host and guest IP as well as choosing different ports for host and guest ports.