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:
emulator-5554
is listed the device 127.0.0.1:5555
is marked offline
and it cannot be used. emulator-5554
must be used then.emulator-5554
is not listed I can use the device 127.0.0.1:5555
without any problem. 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
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.
Attatched to: NAT
Port forwarding
:
ADB#1
, Protocol: TCP
, Host IP: 127.0.0.1
, Host Port: 5555
, Guest IP: 10.0.2.15
, Guest Port: 5555
ADB#2
, Protocol: TCP
, Host IP: 127.0.0.1
, Host Port: 5554
, Guest IP: 10.0.2.15
, Guest Port: 5554
Enable USB Controller
not checkedThe 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.
Is there anything I can do to stop emulator-5554
from starting up and therefore showing up in my adb devices
?
I could solve the problem by using the following port forwarding rules.
Attatched to: NAT
Port forwarding
:
ADB#1
, Protocol: TCP
, Host IP: leave blank, Host Port: 55551
, Guest IP: leave blank, Guest Port: 5555
ADB#2
, Protocol: TCP
, Host IP: leave blank, Host Port: 55541
, Guest IP: leave blank, Guest Port: 5554
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.