Unknown globals when installing ZXing Scanner

南楼画角 提交于 2020-01-07 06:42:15

问题


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.

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'

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?

Thank you in advance.


回答1:


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

  • Clean Project Build
  • Remove ZXing package.
  • Clean Project Build
  • Add ZXing package
  • Clean and Build Project once again

If it won't help:

https://kb.xamarin.com/customer/portal/articles/1638018-my-android-resource-designer-cs-file-will-not-update or https://forums.xamarin.com/discussion/13339/resource-designer-cs-not-regenerated/



来源:https://stackoverflow.com/questions/31855307/unknown-globals-when-installing-zxing-scanner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!