如何查看 .NET MAUI 示例应用程序而不是主屏幕

huangapple go评论60阅读模式
英文:

How to see the .NET MAUI sample application instead of home screen

问题

我刚刚开始使用.NET MAUI,并且已经遇到了一些问题。
不确定所有这些问题是否相关。

这是一台全新的机器,并且已经安装了Visual Studio。

我使用默认模板创建了一个新项目 - .NET MAUI App

  1. 当我重新构建解决方案时,需要超过4分钟。这似乎对于一个单一项目来说太长了。这是否是预期的,还是我需要更多的RAM。
    如何查看 .NET MAUI 示例应用程序而不是主屏幕

  2. 当我运行项目时,它加载主屏幕而不是应用程序。我期望它加载带有计数按钮的.NET MAUI示例应用程序屏幕。

如何查看 .NET MAUI 示例应用程序而不是主屏幕

  1. 当我使用右上角的右侧图标栏中的 x 图标关闭模拟器时,它会关闭模拟器,但几秒钟后会再次打开。

如何查看 .NET MAUI 示例应用程序而不是主屏幕

  1. 当我第二次关闭模拟器时,它完全关闭,但显示错误,表示存在部署错误。

如何查看 .NET MAUI 示例应用程序而不是主屏幕

配置信息:

Visual Studio 2022 v17.6.2
模拟器:Pixel 5 - API 33 (Android 13.0 - API 33)
Windows 11 Pro
16 GB RAM

英文:

I'm just getting started with .NET MAUI and experiencing issues already.
Not sure if all of these issues are related.

This is a new machine and has a fresh installation of Visual Studio.

I Created a new project with the default template - .NET MAUI App

  1. When I rebuild the solution, it takes more than 4 minutes. This seems too long for a single project. Is this expected or do I need more RAM.
    如何查看 .NET MAUI 示例应用程序而不是主屏幕

  2. When I run the project, it loads the home screen and not the application. I'm expecting it to load the .NET MAUI sample application screen with the counter button.

如何查看 .NET MAUI 示例应用程序而不是主屏幕

  1. When I close the simulator using the top right x icon in the right icons bar, it closes the simulator, but after a few seconds, it opens again.

如何查看 .NET MAUI 示例应用程序而不是主屏幕

  1. When I close the simulator the second time, it closes completely but shows an error saying there were deployment errors.

如何查看 .NET MAUI 示例应用程序而不是主屏幕

Configurations:

Visual Studio 2022 v17.6.2
Simulator: Pixel 5 - API 33 (Android 13.0 - API 33)
Windows 11 Pro
16 GB RAM

答案1

得分: 1

安卓模拟器在运行时,如果计算机上不支持硬件加速,速度会变得非常慢。

为了最大化安卓模拟器的性能,有以下虚拟化技术可用于加速安卓模拟器:

  1. Windows Hypervisor Platform (WHPX)
  2. Android模拟器虚拟化驱动程序 (AEHD)

更多信息,请参考如何使用Android模拟器启用硬件加速(Hyper-V和AEHD)

希望能起作用。

英文:

The Android emulator runs too slowly if hardware acceleration is not available on the computer that runs it.

In order to maximize Android Emulator performance, the following virtualization technologies are available for accelerating the Android emulator:

1.The Windows Hypervisor Platform (WHPX).

2.The Android Emulator hypervisor driver (AEHD).

For more info, please refer to How to enable hardware acceleration with Android emulators (Hyper-V & AEHD).

Hope it works.

答案2

得分: 1

可能的两种情景。

  1. Android模拟器已启动并正在运行,但无法从Visual Studio连接(可能是模拟器/Visual Studio的错误)。

  2. Android模拟器窗口已关闭,但其进程仍在运行,不允许启动新的Android模拟器实例。

我的解决方案:

  1. 打开任务管理器
  2. 转到“详细信息”选项卡
  3. 找到“emulator.exe”进程
  4. 鼠标右键单击该进程,然后选择“结束进程树”

之后尝试重新编译和部署应用程序。应该可以正常工作。

英文:

Two possible scenarios.

  1. Android simulator is launched and is running, but it cannot be connected from Visual Studio (Simulator/Visual Studio bug probably).

  2. Android simulator window is closed, but its processes are still running and do not allow to launch new Android simulator instance.

My solution:

  1. Open Task Manager
  2. Go to "Details tab"
  3. Find "emulator.exe" process
  4. Mouse right click on this process and select "End Process Tree"

After that try to compile and deploy your application again. It should work.

如何查看 .NET MAUI 示例应用程序而不是主屏幕

huangapple
  • 本文由 发表于 2023年6月2日 15:01:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387852.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定