mribbons / cordova-plugin-cipherlab-rs30

Apache Cordova Barcode Scanner Plugin for Cipherlab RS30
MIT License
6 stars 12 forks source link

Application crashes #1

Closed eurosystem2000 closed 8 years ago

eurosystem2000 commented 8 years ago

I have a Cipherlab RS30 and my application crashes when I start it. I noticed that commenting on the line: filter.addAction(com.cipherlab.barcode.GeneralString.Intent_READERSERVICE_CONNECTED); my app start well, but i don't receive scans triggered by hardware button. Can anyone help me?

mribbons commented 8 years ago

Hi, Do you get any exception output from here?

https://github.com/mribbons/cordova-plugin-cipherlab-rs30/blob/master/src/android/au/com/micropacific/cordova/CipherlabRS30Plugin.java#L191

Or any other exception output?

Have you got the device set up in keyboard wedge mode or service mode?

Also have you tried compiling the software sample and running from Android Studio?

eurosystem2000 commented 8 years ago

Below the eclipse output

12-11 11:45:42.156: E/AndroidRuntime(8198): FATAL EXCEPTION: main 12-11 11:45:42.156: E/AndroidRuntime(8198): Process: com.Assist.hellogap, PID: 8198 12-11 11:45:42.156: E/AndroidRuntime(8198): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.cipherlab.barcodebaseapi.SERVICE_CONNECTED flg=0x14 } in au.com.micropacific.cordova.DataReceiver@41f17c50 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:808) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.os.Handler.handleCallback(Handler.java:808) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.os.Handler.dispatchMessage(Handler.java:103) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.os.Looper.loop(Looper.java:193) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.app.ActivityThread.main(ActivityThread.java:5323) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.lang.reflect.Method.invokeNative(Native Method) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.lang.reflect.Method.invoke(Method.java:515) 12-11 11:45:42.156: E/AndroidRuntime(8198): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828) 12-11 11:45:42.156: E/AndroidRuntime(8198): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644) 12-11 11:45:42.156: E/AndroidRuntime(8198): at dalvik.system.NativeStart.main(Native Method) 12-11 11:45:42.156: E/AndroidRuntime(8198): Caused by: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = com.cipherlab.barcode.decoder.KeyboardEmulationType) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.os.Parcel.readSerializable(Parcel.java:2219) 12-11 11:45:42.156: E/AndroidRuntime(8198): at com.cipherlab.barcode.decoderparams.ReaderOutputConfiguration.readFromParcel(ReaderOutputConfiguration.java:86) 12-11 11:45:42.156: E/AndroidRuntime(8198): at com.cipherlab.barcodebase.IBarcodeReaderServiceInterface$Stub$Proxy.ReadOutputSettings(IBarcodeReaderServiceInterface.java:1568) 12-11 11:45:42.156: E/AndroidRuntime(8198): at com.cipherlab.barcode.ReaderManagerAPI.GetDataOutputSettings(ReaderManagerAPI.java:1274) 12-11 11:45:42.156: E/AndroidRuntime(8198): at com.cipherlab.barcode.ReaderManager.Get_ReaderOutputConfiguration(ReaderManager.java:760) 12-11 11:45:42.156: E/AndroidRuntime(8198): at au.com.micropacific.cordova.DataReceiver.onReceive(DataReceiver.java:90) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:798) 12-11 11:45:42.156: E/AndroidRuntime(8198): ... 9 more 12-11 11:45:42.156: E/AndroidRuntime(8198): Caused by: java.lang.ClassNotFoundException: com.cipherlab.barcode.decoder.KeyboardEmulationType 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.lang.Class.classForName(Native Method) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.lang.Class.forName(Class.java:251) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2266) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.readEnumDescInternal(ObjectInputStream.java:1554) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.readEnumDesc(ObjectInputStream.java:1535) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.readEnum(ObjectInputStream.java:1580) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:768) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1986) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1943) 12-11 11:45:42.156: E/AndroidRuntime(8198): at android.os.Parcel.readSerializable(Parcel.java:2213) 12-11 11:45:42.156: E/AndroidRuntime(8198): ... 15 more 12-11 11:45:42.156: E/AndroidRuntime(8198): Caused by: java.lang.NoClassDefFoundError: com/cipherlab/barcode/decoder/KeyboardEmulationType 12-11 11:45:42.156: E/AndroidRuntime(8198): ... 25 more 12-11 11:45:42.156: E/AndroidRuntime(8198): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.cipherlab.barcode.decoder.KeyboardEmulationType" on path: DexPathList[[zip file "/data/app/com.Assist.hellogap-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.Assist.hellogap-1, /vendor/lib, /system/lib]] 12-11 11:45:42.156: E/AndroidRuntime(8198): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.lang.ClassLoader.loadClass(ClassLoader.java:497) 12-11 11:45:42.156: E/AndroidRuntime(8198): at java.lang.ClassLoader.loadClass(ClassLoader.java:457) 12-11 11:45:42.156: E/AndroidRuntime(8198): ... 25 more

The device is set to debug mode for emulating my app. I haven't set my device in service mode.

I'm downloading Android Studio now

mribbons commented 8 years ago

If you have Eclipse, there is a sample from Cipherlab for that too so you don't really need AndroidStudio.

Have you modified any of the plugin code? I remember having a crash to desktop type error early on, it was because of a null reference somewhere.

It looks like the DataReceiver hasn't been initialised.

mribbons commented 8 years ago

12-11 11:45:42.156: E/AndroidRuntime(8198): Caused by: java.lang.ClassNotFoundException: com.cipherlab.barcode.decoder.KeyboardEmulationType

There's a setting somewhere for keyboard wedge mode. You want that turned off. Sorry I can't remember what the option is called, I don't have the device anymore.

Have a look in the settings.

eurosystem2000 commented 8 years ago

When I install plugin, the package name is "au.com.micropacific.cordova.CipherlabRS30CordovaPlugin". It makes an error because the java class import a different package (au.com.micropacific.cordova).. so i have simply renamed the package in au.com.micropacific.cordova

eurosystem2000 commented 8 years ago

Ok!!! Now the application doesn't crash! But if I push the hardware button (for starting laser scan), i read barcode but i don't see alert with "scan received: " + data.. Only work with: document.getElementById("scan_button").addEventListener('click', function () { cordova.plugins.CipherlabRS30CordovaPlugin.requestScan(function () { }); });

mribbons commented 8 years ago

interesting... From memory I had hardware scanning working.

Actually I think this is related to the setting for keyboard wedge, you want the opposite setting.

Please submit a pull request for the package name change.

eurosystem2000 commented 8 years ago

Where I can change keyboard wedge settings?

mribbons commented 8 years ago

I can't remember the exact wording or steps to find the option.

It's either in Settings, or there might be a separate app to configure the scanner.

mribbons commented 8 years ago

Can't reproduce plugin name issue. Works fine in an android emulator, no Crash to Desktop.

However can't test with a real RS30 at present.