首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android(单声道),TypeLoadException:“无法加载类型'CameraInfo‘”

Android(单声道),TypeLoadException:“无法加载类型'CameraInfo‘”
EN

Stack Overflow用户
提问于 2014-02-14 11:28:55
回答 1查看 1.3K关注 0票数 0

我使用从http://components.xamarin.com/gettingstarted/zxing.net.mobile下载的Zxing条形码库,使用下面的代码片段读取条形码。Application minVersion选择为2.3,目标版本选择为Automatic。我在Nexus4 (Android 4.4.2)上运行这个应用程序

代码语言:javascript
复制
    BarcodeButton.Click += async delegate 
    {
        var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);
        var result = await scanner.Scan();

        if (result != null)                 
            Toast.MakeText(this,"DONE",ToastLength.Short).Show();
    };

当我运行应用程序时,按下条形码按钮后,将获得此错误日志。错误是什么?我怎么解决这个问题?:

代码语言:javascript
复制
                              ...
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> mscorlib[0x777e2a10]: 9
[Mono] Assembly Ref addref TeleLib[0x784b8c58] -> zxing.monoandroid[0x784ba440]: 2
[Mono] The request to load the assembly mscorlib v2.0.5.0 was remapped to v2.0.0.0
[Mono] Unloading image mscorlib.dll [0x78801068].
[Mono] Assembly Ref addref zxing.monoandroid[0x784ba440] -> mscorlib[0x777e2a10]: 10
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> Mono.Android[0x784bbb98]: 4
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> zxing.monoandroid[0x784ba440]: 3
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> Xamarin.Android.Support.v4[0x784b9848]: 2
[Mono] Assembly Ref addref zxing.monoandroid[0x784ba440] -> Mono.Android[0x784bbb98]: 5
[] TypeRef ResolutionScope not yet handled (14) for .CameraInfo in image /data/data/TeleLib.TeleLib/files/.__override__/ZXing.Net.Mobile.dll
[Mono] The class CameraInfo could not be loaded, used in 
[MonoDroid] UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'CameraInfo'.
[MonoDroid] at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (intptr,intptr,intptr) <0x0005f>
[MonoDroid] at (wrapper dynamic-method) object.c17a61df-f7d9-45dc-ba1c-dac5c5d9eb39 (intptr,intptr,intptr) <0x00043>
[mono] 
[mono] Unhandled Exception:
[mono] System.TypeLoadException: Could not load type 'CameraInfo'.
[mono]   at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (IntPtr jnienv, IntPtr native__this, IntPtr native_holder) [0x00000] in <filename unknown>:0 
[mono]   at (wrapper dynamic-method) object:c17a61df-f7d9-45dc-ba1c-dac5c5d9eb39 (intptr,intptr,intptr)
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'CameraInfo'.
[mono-rt]   at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (IntPtr jnienv, IntPtr native__this, IntPtr native_holder) [0x00000] in <filename unknown>:0 
[mono-rt]   at (wrapper dynamic-method) object:c17a61df-f7d9-45dc-ba1c-dac5c5d9eb39 (intptr,intptr,intptr)
EN

回答 1

Stack Overflow用户

发布于 2014-03-12 20:02:18

我也遇到了同样的问题,我发现ZXing.NET组件需要安卓2.3版本。将您的项目更改为target 2.3或更新版本,此错误将消失。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21770294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档