0

I am running an android emulator on Linux, using the Android Sdk.

The emulator does not seem to have network connection. I do not see any sign of it either inside or in the host.

What could be the cause, how a healthy routing setup looks like, and how can I fix it?

Routing on the host (no matter the emulator is running or not). I miss a virtual device for the emulator and associated routing.

$ ip route show
default via 192.168.1.1 dev wlp1s0 proto dhcp src 192.168.1.65 metric 600 
169.254.0.0/16 dev wlp1s0 scope link metric 1000 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.1.0/24 dev wlp1s0 proto kernel scope link src 192.168.1.65 metric 600 

Routing in the emulator. I miss some default route here.

10.0.0.0/8 dev eth0 proto kernel scope link src 10.0.2.15 
10.0.2.0/24 dev wlan0 proto kernel scope link src 10.0.2.16 

The qemu options of the emulator (s/ /\\\r / for ease of readability). Note that there are some android emulator specific options here.

 /opt/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64\
 -dns-server\
 192.168.1.1,2001:4c48:1::1\
 -mem-path\
 /home/mag/.android/avd/testAVD.avd/snapshots/default_boot/ram.img\
 -mem-file-shared\
 -serial\
 null\
 -device\
 goldfish_pstore,addr=0xff018000,size=0x10000,file=/home/mag/.android/avd/testAVD.avd/data/misc/pstore/pstore.bin\
 -cpu\
 android64\
 -enable-kvm\
 -smp\
 cores=2\
 -m\
 2048\
 -lcd-density\
 160\
 -object\
 iothread,id=disk-iothread\
 -nodefaults\
 -kernel\
 /opt/Android/Sdk/system-images/android-33/google_apis/x86_64//kernel-ranchu\
 -initrd\
 /home/mag/.android/avd/testAVD.avd/initrd\
 -drive\
 if=none,index=0,id=system,if=none,file=/opt/Android/Sdk/system-images/android-33/google_apis/x86_64//system.img,read-only\
 -device\
 virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=1,id=cache,if=none,file=/home/mag/.android/avd/testAVD.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576\
 -device\
 virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=2,id=userdata,if=none,file=/home/mag/.android/avd/testAVD.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576\
 -device\
 virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=3,id=encrypt,if=none,file=/home/mag/.android/avd/testAVD.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576\
 -device\
 virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=4,id=vendor,if=none,file=/opt/Android/Sdk/system-images/android-33/google_apis/x86_64//vendor.img,read-only\
 -device\
 virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=1,id=cache,if=none,file=/home/mag/.android/avd/testAVD.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576\
 -device\
 virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=2,id=userdata,if=none,file=/home/mag/.android/avd/testAVD.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576\
 -device\
 virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=3,id=encrypt,if=none,file=/home/mag/.android/avd/testAVD.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576\
 -device\
 virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify\
 -drive\
 if=none,index=4,id=vendor,if=none,file=/opt/Android/Sdk/system-images/android-33/google_apis/x86_64//vendor.img,read-only\
 -device\
 virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify\
 -netdev\
 user,id=mynet\
 -device\
 virtio-net-pci,netdev=mynet\
 -chardev\
 null,id=forhvc0\
 -chardev\
 null,id=forhvc1\
 -device\
 virtio-serial-pci,ioeventfd=off\
 -device\
 virtconsole,chardev=forhvc0\
 -device\
 virtconsole,chardev=forhvc1\
 -chardev\
 rootcanal,id=rootcanal\
 -device\
 virtserialport,chardev=rootcanal,name=bluetooth\
 -device\
 virt
user157726
  • 113
  • 4

0 Answers0