ARM UWP 应用疑难解答Troubleshooting ARM UWP apps

如果 ARM32 或 ARM64 UWP 应用在 ARM 上无法正常工作,请参阅以下指南。If your ARM32 or ARM64 UWP app isn't working correctly on ARM, here's some guidance that may help.

备注

若要生成 UWP 应用程序以本机方式面向 ARM64 平台,你必须安装有 Visual Studio 2017 版本15.9 或更高版本或 Visual Studio 2019。To build your UWP application to natively target the ARM64 platform, you must have Visual Studio 2017 version 15.9 or later, or Visual Studio 2019. 有关详细信息,请参阅此博客文章For more information, see this blog post.

常见问题Common issues

下面是在 ARM32 和 ARM64 应用疑难解答时要注意的一些常见问题。Here are some common issues to keep in mind when troubleshooting ARM32 and ARM64 apps.

在基于 ARM 的处理器上使用只适用于 Windows 10 移动版的 APIUsing Windows 10 Mobile-only APIs on ARM-based processors

使用仅移动 Api (例如 HardwareButtons) 时,ARM 应用可能遇到问题。ARM apps may run into problems when using mobile-only APIs (for example, HardwareButtons). 若要缓解这种风险,你可以在调用此类 API 前动态检测你的应用是否运行在 Windows 10 移动版上。To mitigate this, you can dynamically detect whether your app is running on Windows 10 Mobile before calling these APIs. 请按照博客文章使用 API 协定动态检测功能中的指南操作。Follow the guidance in the blog post, Dynamically detecting features with API contracts.

包含 UWP 应用不支持的依赖关系Including dependencies not supported by UWP apps

通用 Windows 平台 (UWP) 未使用 Visual Studio 正确生成的应用,UWP SDK 可能会依赖于在 ARM64 系统上运行的 ARM 应用不可用的 OS 组件。Universal Windows Platform (UWP) apps that aren't properly built with Visual Studio and the UWP SDK may have dependencies on OS components that aren't available to ARM apps running on an ARM64 system. 这些依赖关系的示例包括:Examples of these dependencies include:

  • 假设能够使用 .NET Framework 的某些部分。Expecting parts of the .NET Framework to be available.
  • 引用与 UWP 不兼容的第三方 .NET 组件。Referencing third-party .NET components that aren't compatible with UWP.

可以通过以下方式解决这些问题:删除不可用的依赖项,并使用最新的 Microsoft Visual Studio 和 UWP SDK 版本重新生成应用;或者作为最后一种手段,从 Microsoft Store 中删除 ARM 应用,以便应用程序的 x86 版本 (如果) 下载到用户的 Pc 中。These issues can be resolved by: removing the unavailable dependencies and rebuilding the app by using the latest Microsoft Visual Studio and UWP SDK versions; or as a last resort, removing the ARM app from the Microsoft Store, so that the x86 version of the app (if available) is downloaded to users’ PCs.

有关可用于 UWP 应用的 .NET API 的详细信息,请参阅适用于 UWP 应用的 .NETFor more info on .NET APIs available for UWP apps, see .NET for UWP apps

使用较早版本的 Visual Studio 和 SDK 编译应用Compiling an app with an older version of Visual Studio and SDK

如果遇到问题,请务必使用最新版本的 Microsoft Visual Studio 和 Windows SDK 编译你的应用。If you're running into issues, be sure to use the latest versions of Microsoft Visual Studio and the Windows SDK to compile your app. 使用早期版本的 Visual Studio 和 SDK 编译的应用可能存在已在更高版本中修复的问题。Apps compiled with an earlier version of Visual Studio and the SDK may have issues that have been fixed in later versions.

调试Debugging

可以使用现有工具来开发 ARM 平台的应用。You can use existing tools for developing apps for the ARM platform. 下面是一些有用的资源。Here are some helpful resources.

  • Visual Studio 15.5 Preview 1 及更高版本支持使用通用身份验证模式运行 ARM32 应用。Visual Studio 15.5 Preview 1 and later supports running ARM32 apps by using Universal Authentication mode. 这将自动启动必要的远程调试工具。This automatically bootstraps the necessary remote debugging tools.
  • 有关在 ARM 上进行调试的工具和策略的详细信息,请参阅在 ARM64 上进行调试See Debugging on ARM64 to learn more about tools and strategies for debugging on ARM.