Search code examples
javaandroidcordovazxingcordova-2.0.0

Can't start barcode scanner with PhoneGap plugin


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():

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:

Reference successfully added to project

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

Reference error!

What's going on here?


Solution

  • 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.