安装ZXing Scanner时未知的全局变量 [英] Unknown globals when installing ZXing Scanner

查看:111
本文介绍了安装ZXing Scanner时未知的全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Xamarin.Forms项目,需要一个QR码扫描仪.我发现ZXing Scanner似乎是一个建立良好的库.

I have a Xamarin.Forms project which needs a QR code scanner. I found ZXing Scanner which seems to be a well established library for such purposes.

我将其安装在相应的android项目中,该项目正常运行.当我要构建应用程序时,使用以下几行调整了Resource.Designer.cs:

I installed it in the corresponding android project which worked without errors. When I wanted to build the app, Resource.Designer.cs was adjusted with the following lines:

global::ZXing.Mobile.Resource.Id.contentFrame = global::my.project.Droid.Resource.Id.contentFrame;
global::ZXing.Mobile.Resource.Layout.zxingscanneractivitylayout = global::my.project.Droid.Resource.Layout.zxingscanneractivitylayout;
global::ZXing.Mobile.Resource.Layout.zxingscannerfragmentlayout = global::my.project.Droid.Resource.Layout.zxingscannerfragmentlayout;

问题是我也遇到以下错误:

The problem is that I as well get the following errors:

'my.project.Droid.Resource.Id' does not contain a definition for 'contentFrame' 
'my.project.Droid.Resource.Layout' does not contain a definition for 'zxingscanneractivitylayout'
'my.project.Droid.Resource.Layout' does not contain a definition for 'zxingscannerfragmentlayout'

我使用NuGet安装了ZXing,但我也尝试手动添加dll.我得到同样的错误.谁能帮我解决这个问题?

I installed ZXing using NuGet but I as well tried to add the dlls manually. I get the same errors. Can anyone help me how to fix this?

谢谢.

推荐答案

您的Resource.Designer.cs很可能没有正确更新:

It's quite possible that your Resource.Designer.cs is not updating correctly:

  • 清理项目构建
  • 删除ZXing软件包.
  • 清理项目构建
  • 添加ZXing程序包
  • 再次清理并构建项目

如果无济于事:

https://kb.xamarin.com/customer/portal/articles/1638018-my-android-resource-designer-cs-file-will-not-update 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆