Xamarin 表单 - 突然出现错误 XA0137

Xamarin forms - suddenly I get error XA0137

我在 Xamarin Forms 中有一个应用程序,我正在使用 VS Community 2022(版本 17.0.4)。我在 Android 11 的物理三星 Galaxy S10 上测试我的应用程序。 我正在编写我的应用程序,当我想在一个小的代码更改后部署我的应用程序时突然出现错误。

Severity Code Description Project File Line Suppression State Error XA0137: The 'run-as' command failed with 'run-as: couldn't stat /data/user/0/com.app.local: No such file or directory '. Fast Deployment is not currently supported on this device. Please file an issue with the exact error message using the 'Help->Send Feedback->Report a Problem' menu item in Visual Studio or 'Help->Report a Problem' in Visual Studio for Mac. Please set the 'EmbedAssembliesIntoApk' MSBuild property to 'true' to disable Fast Deployment in the Visual Studio project property pages, or edit the project file in a text editor.

这非常有趣,因为它在我收到此错误前 10 秒起作用,所以这里还有其他问题。我恢复了我的代码更改但没有成功。我还禁用了快速部署,在这种情况下,错误消失了,但部署仍然没有发生,也没有显示其他错误。由于某种原因,VS 只是没有部署。这让我相信其他事情是错误的。

有人有什么想法吗?

更新:我在另一台设备(平板电脑)上部署了该应用程序并且可以正常工作,所以问题应该出在我的 phone。

我在尝试一个新的 MAUI 项目时遇到了这个错误。我的第一次部署(通过 VS)很顺利,应用程序运行良好。 当我从我的设备上手动卸载该应用程序,然后尝试使用 VS 重新部署它时,我开始收到此错误。


XA0137: The 'run-as' command failed with 'run-as: couldn't stat /data/user/0/com.companyname.mauiappshell: No such file or directory


我可以绕过此部署错误的唯一方法是从 MAUI 项目文件中手动重命名 ApplicationId

因此,如果您的应用程序 ID 类似于

<ApplicationId>com.companyname.appname</ApplicationId>

重命名为

<ApplicationId>com.companyname.1.appname</ApplicationId>

并尝试 re-deploy 该应用程序到您的设备。