【问题标题】:Xamarin.Essentials Screenshot not working on AndroidXamarin.Essentials 屏幕截图无法在 Android 上运行
【发布时间】:2021-01-13 21:37:03
【问题描述】:

我正在关注文档:https://docs.microsoft.com/en-us/xamarin/essentials/screenshot 截取屏幕截图并将其保存到MemoryStream,然后将其用作“imagetest”的图像源(单击按钮。下面是我的CaptureScreenshot() 函数代码,并且在 Android 10 设备上执行按钮单击时出现以下错误。我正在运行最新版本的 Xamarin.Essentials 和 Xamarin.Forms。

功能:

        private async void CaptureScreenshot(object sender, EventArgs e)
    {
        var screenshot = await Screenshot.CaptureAsync();
        var stream = await screenshot.OpenReadAsync();
        var array_image = ImageSource.FromStream(() => stream);
        imagetest.Source = array_image;
    }

错误:

"System.TypeLoadException Message=Could not load type of field 'Order_Form_V1.CustomArrayConfiguration+d__3:5__2' (6) due to: 无法使用 typeref 中的令牌 01000029 解析类型(程序集“Xamarin.Essentials,版本”中的预期类“Xamarin.Essentials.ScreenshotResult” =1.0.0.0,Culture=neutral,PublicKeyToken=null') 程序集:Xamarin.Essentials,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null 类型:Xamarin.Essentials.ScreenshotResult 成员:(null)"

感谢我能得到的任何意见。

【问题讨论】:

    标签: c# xamarin.forms screenshot xamarin.essentials


    【解决方案1】:

    您可以尝试 cleaning 解决方案并删除所有 bin 和 obj 文件夹,然后 rebulding 检查它是否有效。

    Xamarin 表单:5.0.0.1874

    Xamarin Essentials:1.6.0

    Visual Studio:16.8.4

    【讨论】:

    • 哇 - 就像一个魅力!非常感谢:)
    • 我正在截取我的视频应用程序。它截取屏幕截图但不捕获视频部分。视频部分为黑色。有人帮忙吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-24
    • 2021-07-12
    • 2019-12-29
    • 1970-01-01
    • 2017-10-09
    • 1970-01-01
    • 2014-12-08
    相关资源
    最近更新 更多