Status Update
Comments
do...@gmail.com <do...@gmail.com> #2
Please Read:
Android Studio Version: Unknown
Emulator Version (Emulator--> Extended Controls--> Emulator Version): 31.3.15-9456632 HAXM / KVM Version: HVF 13.0.0
Android SDK Tools: 26.1.1
Host Operating System: macOS 13.0.1
CPU Manufacturer: Other CPU: 64-bit CPU
RAM: 32768 MB
GPU:
Build Fingerprint:
AVD Details: Name: Pixel_2_API_33 CPU/ABI: arm64 Path: /.android/avd/Pixel_2_API_33.avd Target: google_apis_playstore [Google Play] (API level 33) Skin: 1080x1920 SD Card: 512M AvdId: Pixel_2_API_33 PlayStore.enabled: true avd.ini.displayname: Pixel 2 API 33 avd.ini.encoding: UTF-8 disk.dataPartition.size: 6442450944 fastboot.chosenSnapshotFile: fastboot.forceChosenSnapshotBoot: no fastboot.forceColdBoot: no fastboot.forceFastBoot: yes hw.accelerometer: yes hw.arc: false hw.audioInput: yes hw.battery: yes hw.camera.back: virtualscene hw.camera.front: emulated hw.cpu.ncore: 4 hw.dPad: no hw.device.hash2: MD5:55acbc835978f326788ed66a5cd4c9a7 hw.device.manufacturer: Google hw.device.name: pixel_2 hw.gps: yes hw.gpu.enabled: yes hw.gpu.mode: auto hw.initialOrientation: Portrait hw.keyboard: yes hw.lcd.density: 420 hw.lcd.height: 1920 hw.lcd.width: 1080 hw.mainKeys: no hw.ramSize: 1536 hw.sdCard: yes hw.sensors.orientation: yes hw.sensors.proximity: yes hw.trackBall: no image.sysdir.1: system-images/android-33/google_apis_playstore/arm64-v8a/ runtime.network.latency: none runtime.network.speed: full showDeviceFrame: no skin.dynamic: yes skin.path.backup: /Users/***/Development/Android/skins/pixel_2 tag.display: Google Play tag.id: google_apis_playstore vm.heapSize: 228
Steps to Reproduce Bug:
Install Android Studio Eel
Create an emulator with API 23
Run the emulator from AS
The emulator started from Android studio can't resolve any URLs.
Android Studio: Android Studio Electric Eel | 2022.1.1 Build #AI-221.6008.13.2211.9477386, built on January 11, 2023 Runtime version: 11.0.15+0-b2043.56-8887301 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.0.1 GC: G1 Young Generation, G1 Old Generation Memory: 5128M Cores: 10 Registry: external.system.auto.import.disabled=true ide.text.editor.with.preview.show.floating.toolbar=false ide.instant.shutdown=false ide.balloon.shadow.size=0
Non-Bundled Plugins: org.toml.lang (221.6008.15) com.intellij.marketplace (221.6008.18) Key Promoter X (2022.2) mobi.hsz.idea.gitignore (4.4.0) com.developerphil.adbidea (1.6.8) izhangzhihao.rainbow.brackets (2023.1.1-ij)
What helps is to start the emulator from the command line -netdelay none -netspeed full -dns-server '2001:4860:4860::8844,2001:4860:4860::8888,8.8.8.8,8.8.4.4'
Expected Behavior:
Network works on emulator started from AS.
Observed Behavior:
Emualtor started from AS either "in-window" or in a separate window can't set up a network. Though it looks like emulators with API 23,24,25 work fine.
ml...@google.com <ml...@google.com>
bo...@google.com <bo...@google.com>
wd...@google.com <wd...@google.com> #3
I think it has to do with your dns configuration on host. Since you mentioned that running command line -netdelay none -netspeed full -dns-server '2001:4860:4860::8844,2001:4860:4860::8888,8.8.8.8,8.8.4.4'
works for you. I wonder if you could run emulator with command line
-verbose
and send the log to us. It will print out the dns server being used.
do...@gmail.com <do...@gmail.com> #4
Thank you for your reply! Here you can find the log. It's worth noting that I haven't changed any default settings.
wd...@google.com <wd...@google.com> #5
VERBOSE | Found 2 DNS servers:
VERBOSE | fe80::16de:39ff:fe44:5806
VERBOSE | 192.168.1.1
It looks like emulator is trying to use fe80::16de:39ff:fe44:5806
which is the link-local address. Emulator always seem to have a problem with local addresses.
wd...@google.com <wd...@google.com> #6
Hi @maze, do you think it would make sense for emulator to switch to 2001:4860:4860::8844
when ipv6 link local address is present in the local dns config file? Apparently, there is some issue with DNS probe when the host DNS address is link local.
ma...@google.com <ma...@google.com> #7
fe80::16de:39ff:fe44:5806%eth0 (eth0 being the relevant nic)
or
fe80::16de:39ff:fe44:5806%2 (2 being the ifindex of the relevant nic)
are valid ips.
See
IFIRC many of the Linux kernel APIs (like connect(), sendto(), sendmsg(), bind()) fail when you pass in a scope-less link local IPv6 address, because they're insufficiently defined.
Furthermore link local traffic is not forwardable (simply because it's link local...)
Honestly, this feels like a network misconfiguration, as a link local DNS server is simply not reachable (without something like NAT or other hacks) from a VM, without that VM being quite literally bridged into the network (which doesn't work with normal wifi networks, as they don't support ethernet bridging) - AFAIK Android Emulator doesn't bridge (and I don't think that would work for other reasons - including that bridging would need admin privs)
Fixes in order of preference:
(a) The network should 'simply' be fixed to return a non-link local DNS IPv6 address.
(b) Make Android Studio simply ignore fe80::/64 dns servers (strip them out, you'd be left with just 192.168.1.1) - though this may end up with Android Studio networking coming up without any ipv6 connection.
(c) You could in such a case use a hardcoded DNS server - like the Google DNS ips you mentioned in #6.
However, not using the DNS provided by the system is usually something that shouldn't be done (for privacy reasons...)
As such I'd recommend doing (a) and/or (b) and perhaps adding a flag (or config option or something) to manually specify / override the DNS servers to use (perhaps one for ipv4, one for ipv6??).
To make it easier on users you could have some sort of drop down box (network provided, google dns, cloudflare dns, quad9, custom) and a field to fill in.
Note that using a global DNS resolver like Google DNS will result in local stuff (like router.lan or gateway.local) not resolving, but that's likely fine for the emulator.
(d) You could run a dns cache as part of Android Studio (and replace the link local IP with its IP), or manually forward the packets (assuming the VM even sends them out) with some NAT66 or even NAT64.
I'm including this for completeness, but I wouldn't recommend it, seems like a lot of needless complexity in the emulator.
ma...@google.com <ma...@google.com> #8
And of course ::1 or
wd...@google.com <wd...@google.com> #9
RE#7 Thanks for the detailed explanation and really appreciate the solution mentioned in
Fixes in order of preference:
(a) The network should 'simply' be fixed to return a non-link local DNS IPv6 address.
(b) Make Android Studio simply ignore fe80::/64 dns servers (strip them out, you'd be left with just 192.168.1.1) - though this may end up with Android Studio networking coming up without any ipv6 connection.
(c) You could in such a case use a hardcoded DNS server - like the Google DNS ips you mentioned in #6.
However, not using the DNS provided by the system is usually something that shouldn't be done (for privacy reasons...)
As such I'd recommend doing (a) and/or (b) and perhaps adding a flag (or config option or something) to manually specify / override the DNS servers to use (perhaps one for ipv4, one for ipv6??).
I think emulator should implement (b) at least and (c) should be only enabled if an option is provided.
do...@gmail.com <do...@gmail.com> #11
Apparently, the issue has been resolved in Android Emulator 32.1.11-9536276. After updating and restarting AS I see that network works.
However, if I run from CL, network works but log is the same for 32.1.11 with pixel 2 API 33:
VERBOSE | Found 2 DNS servers:
VERBOSE | fe80::16de:39ff:fe44:5806
VERBOSE | 192.168.1.1
wd...@google.com <wd...@google.com> #12
RE#11 Ok, let me see what has been changed from build 9456632 to build 9536276. Thanks again for the information.
wd...@google.com <wd...@google.com> #13
RE#11
I found the culprit. It's this /etc/resolve.conf
are passed into slirp instances.
In Android Emulator 32.1.11-9536276, the aforementioned CL was not cherry-picked while in emulator 31.3.15-9456632, the CL was merged. Therefore, the "problematic" link local DNS is passed into emulator 31 release but not emulator 32 release.
Solution: make sure the
go...@gmail.com <go...@gmail.com> #15
wd...@google.com <wd...@google.com> #16
RE#15 It seems like this is a different topic if you cannot install android studio on your laptop. Would you like to file a different bug?
Description
Description has been deleted.