无法使用PhoneGap插件启动条形码扫描程序

时间:2022-04-02 20:54:56

I'm trying to use the barcode scanner plugin for PhoneGap. I've followed the instructions in the readme, but the PhoneGap app simply crashes when I call window.plugins.barcodeScanner.scan():

我正在尝试使用PhoneGap的条形码扫描程序插件。我按照自述文件中的说明进行操作,但是当我调用window.plugins.barcodeScanner.scan()时,PhoneGap应用程序只会崩溃:

E/AndroidRuntime(15842): java.lang.RuntimeException: Unable to instantiate
activity ComponentInfo{mypackage/com.google.zxing.client.android.CaptureActivity}:
java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity

I suspect this has something to do with the fact that after I add a reference to the plugin's LibraryProject, it doesn't actually stick. When I go to my project's properties, Android, I can add a reference to the BarcodeScanner\LibraryProject:

我怀疑这与我添加对插件的LibraryProject的引用之后的事实有关,它实际上并没有坚持。当我转到项目的属性Android时,我可以添加对BarcodeScanner \ LibraryProject的引用:

无法使用PhoneGap插件启动条形码扫描程序

But after I click Apply and OK and then reopen the project's properties, the reference has a red X:

但是在我单击“应用”和“确定”然后重新打开项目的属性后,引用具有红色X:

无法使用PhoneGap插件启动条形码扫描程序

What's going on here?

这里发生了什么?

3 个解决方案

#1


0  

Have you tried upgrading eclipse? i was having some issues with eclipse not loading all files, i had to run eclipse as administrator in windows 7 and upgraded, this took care of my issue.

你试过升级eclipse吗?我有一些问题与eclipse没有加载所有文件,我不得不在Windows 7中以管理员身份运行eclipse并升级,这照顾了我的问题。

#2


0  

I have done a work around for this problem.Instead of importing BarCode Library project to eclipse, create new project and add packages and class files manually. Then build the library project without error.After that you can add this library to your project and scan function will work fine.

我已经解决了这个问题。而不是将BarCode Library项目导入eclipse,创建新项目并手动添加包和类文件。然后构建库项目,没有错误。之后,您可以将此库添加到您的项目,扫描功能将正常工作。

#3


0  

I ended up just calling out to the installed Barcode Scanner app rather than trying to include the code as a part of my project.

我最后只是调用已安装的Barcode Scanner应用程序,而不是尝试将代码作为项目的一部分。

#1


0  

Have you tried upgrading eclipse? i was having some issues with eclipse not loading all files, i had to run eclipse as administrator in windows 7 and upgraded, this took care of my issue.

你试过升级eclipse吗?我有一些问题与eclipse没有加载所有文件,我不得不在Windows 7中以管理员身份运行eclipse并升级,这照顾了我的问题。

#2


0  

I have done a work around for this problem.Instead of importing BarCode Library project to eclipse, create new project and add packages and class files manually. Then build the library project without error.After that you can add this library to your project and scan function will work fine.

我已经解决了这个问题。而不是将BarCode Library项目导入eclipse,创建新项目并手动添加包和类文件。然后构建库项目,没有错误。之后,您可以将此库添加到您的项目,扫描功能将正常工作。

#3


0  

I ended up just calling out to the installed Barcode Scanner app rather than trying to include the code as a part of my project.

我最后只是调用已安装的Barcode Scanner应用程序,而不是尝试将代码作为项目的一部分。