在 Android 模拟器上启用 WiFi

发布于 2024-12-11 17:45:35 字数 57 浏览 0 评论 0原文

如何在Android模拟器上启用WiFi?我试图找到这个,但每个人都将 WiFi 与 3G 混淆了。

How to enable WiFi on Android emulator? I have tried to find this but everyone is confusing WiFi with 3G.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

ぇ气 2024-12-18 17:45:35

如果您使用的 API 级别低于 25,则 Wifi 在模拟器上不可用。

当使用 API 级别 25 或更高级别的 AVD 时,模拟器提供
模拟 Wi-Fi 接入点(“AndroidWifi”)和 Android
自动连接到它。

更多信息:
https://developer.android.com/studio/run/emulator.html#wifi

Wifi is not available on the emulator if you are using below of API level 25.

When using an AVD with API level 25 or higher, the emulator provides a
simulated Wi-Fi access point ("AndroidWifi"), and Android
automatically connects to it.

More Information:
https://developer.android.com/studio/run/emulator.html#wifi

海螺姑娘 2024-12-18 17:45:35

显然事实并非如此,我也没想到会如此。然而,Ivan 提出了一个很好的可能性,但 Android 人员却没有注意到。

模拟器的目的是什么?模仿,对吧?我不明白为什么出于测试目的 - 假设测试人员了解限制 - 模拟器可能不会添加 Wifi 模拟器。

例如,它可以通过使用主机的底层互联网连接来模拟 WiFi 访问。显然,测试 WPA/WEP 差异没有意义,但至少它可以通过 WiFi 切换访问。

或者某种模拟器插件,其中有一个基本的 WiFi 模拟器,可以通过底层连接模拟 WiFi 访问,然后通过配置,它可以通过提供假 WiFi 网络列表及其相应的匹配假密码来模拟 WPA/WEP针对可配置的凭据列表。

毕竟,我们的想法是在模拟器上进行初始测试,然后转移到实际设备上。

Apparently it does not and I didn't quite expect it would. HOWEVER Ivan brings up a good possibility that has escaped Android people.

What is the purpose of an emulator? to EMULATE, right? I don't see why for testing purposes -provided the tester understands the limitations- the emulator might not add a Wifi emulator.

It could for example emulate WiFi access by using the underlying internet connection of the host. Obviously testing WPA/WEP differencess would not make sense but at least it could toggle access via WiFi.

Or some sort of emulator plugin where there would be a base WiFi emulator that would emulate WiFi access via the underlying connection but then via configuration it could emulate WPA/WEP by providing a list of fake WiFi networks and their corresponding fake passwords that would be matched against a configurable list of credentials.

After all the idea is to do initial testing on the emulator and then move on to the actual device.

悲歌长辞 2024-12-18 17:45:35

截至目前,随着 Android 模拟器的修订版 26.1.3,它终于可以在 API 25 的映像 v8 上实现。
如果模拟器是在升级到最新的 API 25 映像之前创建的,则您需要擦除数据,或者根据需要删除并重新创建映像。

在某些系统映像中添加了对 Wi-Fi 的支持(目前仅 API
25级)。名为“AndroidWifi”的接入点可用,并且
Android 会自动连接到它。可以通过以下方式禁用 Wi-Fi 支持
使用命令行参数 -feature -Wifi 运行模拟器。

来自 https://developer.android.com/studio/releases/ emulator.html#26-1-3

As of now, with Revision 26.1.3 of the android emulator, it is finally possible on the image v8 of the API 25.
If the emulator was created before you upgrade to the latest API 25 image, you need to wipe data or simply delete and recreate your image if you prefer.

Added support for Wi-Fi in some system images (currently only API
level 25). An access point called "AndroidWifi" is available and
Android automatically connects to it. Wi-Fi support can be disabled by
running the emulator with the command line parameter -feature -Wifi.

from https://developer.android.com/studio/releases/emulator.html#26-1-3

避讳 2024-12-18 17:45:35

(这里重复我在别处的回答。)

理论上,linux(android底层的内核)有mac80211_hwsim 驱动程序,模拟 WiFi。它可用于设置多个 WiFi 设备(一个接入点和另一个 WiFi 设备等),从而组成一个 WiFi 网络。

它对于在 Linux 下测试 WiFi 程序很有用。有可能,即使在 用户模式 ​​linux 或其他带有 linux 的隔离虚拟“盒子”下也是如此。

理论上,这个驱动程序可以用于在没有真正的 WiFi 设备(或不想使用它)的 Android 系统中进行测试,也可以在某种 Android 模拟器中进行测试。也许,人们可以设法在 android-x86 中使用此驱动程序,或者在 VirtualBox 中运行的 android-x86 中进行测试。

(Repeating here my answer elsewhere.)

In theory, linux (the kernel underlying android) has mac80211_hwsim driver, which simulates WiFi. It can be used to set up several WiFi devices (an acces point, and another WiFi device, and so on), which would make up a WiFi network.

It's useful for testing WiFi programs under linux. Possibly, even under user-mode linux or other isolated virtual "boxes" with linux.

In theory, this driver could be used for tests in the android systems where you don't have a real WiFi device (or don't want to use it), and also in some kind of android emulators. Perhaps, one can manage to use this driver in android-x86, or--for testing--in android-x86 run in VirtualBox.

一指流沙 2024-12-18 17:45:35

如果您使用 API 24 或更早版本,模拟器不会为 Wi-Fi 提供虚拟硬件。来自 Android 开发者网站:

当使用 API 级别 25 或更高级别的 AVD 时,模拟器会提供模拟 Wi-Fi 接入点(“AndroidWifi”),Android 会自动连接到它。

您可以通过使用命令行参数 -feature -Wifi 运行模拟器来禁用模拟器中的 Wi-Fi。

https://developer.android.com/studio/run/emulator。 html#wi-fi

不支持的内容

Android 模拟器不包含虚拟
以下硬件:

  • 蓝牙
  • NFC
  • SD 卡插入/弹出
  • 设备连接的耳机
  • USB

Android Wear 的手表模拟器不支持概述(最近的
应用程序)按钮、方向键和指纹传感器。

(了解更多信息 https://developer.android.com/studio/run/ emulator.html#about)

https://developer.android.com/studio/run/emulator.html#wi-fi

The emulator does not provide virtual hardware for Wi-Fi if you use API 24 or earlier. From the Android Developers website:

When using an AVD with API level 25 or higher, the emulator provides a simulated Wi-Fi access point ("AndroidWifi"), and Android automatically connects to it.

You can disable Wi-Fi in the emulator by running the emulator with the command-line parameter -feature -Wifi.

https://developer.android.com/studio/run/emulator.html#wi-fi

What's not supported

The Android Emulator doesn't include virtual
hardware for the following:

  • Bluetooth
  • NFC
  • SD card insert/eject
  • Device-attached headphones
  • USB

The watch emulator for Android Wear doesn't support the Overview (Recent
Apps) button, D-pad, and fingerprint sensor.

(read more at https://developer.android.com/studio/run/emulator.html#about)

https://developer.android.com/studio/run/emulator.html#wi-fi

坏尐絯℡ 2024-12-18 17:45:35

当使用 API 级别 25 或更高级别的 AVD 时,模拟器会提供模拟的 Wi-Fi 接入点(“AndroidWifi”),Android 会自动连接到它。

来源: https://developer.android.com/studio/run/ emulator.html#wi-fi

When using an AVD with API level 25 or higher, the emulator provides a simulated Wi-Fi access point ("AndroidWifi"), and Android automatically connects to it.

Source : https://developer.android.com/studio/run/emulator.html#wi-fi

隱形的亼 2024-12-18 17:45:35

如果你的模拟器没有连接到 wifi 而你使用的是 Mac(我不知道如何在 Windows 上添加 DNS),只需转到
网络->高级-> DNS并添加8.8.8.8和8.8.4.4,然后关闭Android模拟器,打开Android Studio,选择模拟器并单击冷重启,然后您的模拟器将连接到wifi。

If your simulator is not connecting to wifi and you're on a Mac (I don't know how to add DNS on windows) just go to
Network -> advanced -> DNS and add 8.8.8.8 and 8.8.4.4 then close the Android emulator, open Android Studio, select the emulator and click on cold reboot then your emulator will be connected to wifi.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文