xamarin.sentials&quort“类型或名称空间名称”'找不到您的任务A使用指令或组装参考吗?

发布于 2025-02-11 03:09:50 字数 619 浏览 2 评论 0 原文

using Xamarin.Forms.Xaml;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Essentials;


[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]

看来最后一行的代码不起作用,但是在阅读此&GT之后; 。它指出,我要添加的只是我汇编文件文件的最后一行。不确定如何修复它。它指出IM需要为任何Android设备添加最后一行。但是,看来它没有识别使用perpermission。我该如何解决?

这是实际错误:

错误CS0246找不到类型或名称名称“ usePermissionAttribute”(您是否缺少使用指令或汇编引用?)

using Xamarin.Forms.Xaml;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Essentials;


[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]

It seems the last line of code is not working, however after reading this > https://learn.microsoft.com/en-us/xamarin/essentials/vibrate?tabs=android. It states that all I have to add is the last line to my AssemblyInfo.cs file. Not sure how to fix it. It states that im required to add the last line for any android device. However it seems that it does not recognize the UsesPermission. How can I fix this?

Here is the actual error:

Error CS0246 The type or namespace name 'UsesPermissionAttribute' could not be found (are you missing a using directive or an assembly reference?)

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

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

发布评论

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

评论(1

不气馁 2025-02-18 03:09:50

您缺少对android.app namespace的引用 - usepermissionAttribute 在其中。尝试使用android.app; 添加

You are missing reference to Android.App namespace - UsesPermissionAttribute is in there. Try adding using Android.App;.

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