找不到类型或命名空间名称 'ZXing'
The type or namespace name 'ZXing' could not be found
在 Visual Studio 2017 年,我有一个准系统 Xamarin.Forms 项目,我想用它来测试使用 ZXing 扫描条码。我添加了 FastAndroidCamera、ZXing.Net.Mobile 和 ZXing.Net.Mobile.Forms Nuget 包。每当我在 Android 项目 MainActivity class 中添加任何对 ZXing 的引用时,我都会收到此错误:
> The type or namespace name 'ZXing' could not be found (are you missing
> a using directive or an assembly reference?)
我得到错误,即使唯一的引用是
using ZXing.Net.Mobile.Forms;
这将 运行 在模拟器上没有错误,但是一旦我尝试在我的 phone 或平板电脑上使用 LivePlayer 运行 它失败并显示以上消息在 VS 错误列表中。
我尝试了 https://components.xamarin.com/gettingstarted/zxing.net.mobile.forms 上的入门信息,但没有成功。我也曾尝试在 github 上使用官方 ZXing 示例解决方案,但是当我尝试在 VS2017 中加载解决方案时出现很多错误,但它没有帮助。
除了将 Nuget 包添加到项目引用并添加 "using" 语句之外,您还需要做些什么吗?
这不是 Visual Studio 2017 中 Live Player 问题的解决方案,但它是一种变通方法。当我直接部署到我的 Android 设备时,它运行没有错误。人们一直警告我不要使用 android 模拟器,我想这同样适用于 Live Player。
这个故事的寓意是,如果某个应用无法在 android 模拟器或 Live Player 中运行,则可能不是该应用的问题...请在真实设备上尝试。
在 Visual Studio 2017 年,我有一个准系统 Xamarin.Forms 项目,我想用它来测试使用 ZXing 扫描条码。我添加了 FastAndroidCamera、ZXing.Net.Mobile 和 ZXing.Net.Mobile.Forms Nuget 包。每当我在 Android 项目 MainActivity class 中添加任何对 ZXing 的引用时,我都会收到此错误:
> The type or namespace name 'ZXing' could not be found (are you missing
> a using directive or an assembly reference?)
我得到错误,即使唯一的引用是
using ZXing.Net.Mobile.Forms;
这将 运行 在模拟器上没有错误,但是一旦我尝试在我的 phone 或平板电脑上使用 LivePlayer 运行 它失败并显示以上消息在 VS 错误列表中。
我尝试了 https://components.xamarin.com/gettingstarted/zxing.net.mobile.forms 上的入门信息,但没有成功。我也曾尝试在 github 上使用官方 ZXing 示例解决方案,但是当我尝试在 VS2017 中加载解决方案时出现很多错误,但它没有帮助。
除了将 Nuget 包添加到项目引用并添加 "using" 语句之外,您还需要做些什么吗?
这不是 Visual Studio 2017 中 Live Player 问题的解决方案,但它是一种变通方法。当我直接部署到我的 Android 设备时,它运行没有错误。人们一直警告我不要使用 android 模拟器,我想这同样适用于 Live Player。 这个故事的寓意是,如果某个应用无法在 android 模拟器或 Live Player 中运行,则可能不是该应用的问题...请在真实设备上尝试。