Android的ZXing集成错误 [英] Android ZXing integration errors

查看:598
本文介绍了Android的ZXing集成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个学生和我在学校的Andr​​oid项目的一部分,我需要包括一个酒吧code的应用程序。我清楚地遵循的指示

I am a student and as a part of my android project at school, I need to include a barcode app. I have clearly followed instructions given in

<一个href=\"http://damianflannery.word$p$pss.com/2011/06/13/integrate-zxing-bar$c$c-scanner-into-your-android-app-natively-using-eclipse/\" rel=\"nofollow\">http://damianflannery.word$p$pss.com/2011/06/13/integrate-zxing-bar$c$c-scanner-into-your-android-app-natively-using-eclipse/

整合ZXing。我在3班,CaptureActivityHandler,德$ C $钱德勒和SearchBookContentsActivity,这是由改变的switch-case语句的if-else如下解决了错误:

to integrate ZXing. I had errors in 3 classes, CaptureActivityHandler, DecodeHandler and SearchBookContentsActivity, which were solved by changing the switch-case statements to if-else as follows:

if(message.what==R.id.decode){
        decode((byte[]) message.obj, message.arg1, message.arg2);
    }
    else if(message.what==R.id.quit){
        running = false;
        Looper.myLooper().quit();
    }

在我的应用程序,在pressing一个按钮,酒吧code扫描仪意图应该开始。但我只得到一个错误,说我的应用程序已经停止。该logcat的消息如下:

In my application, on pressing a button, the barcode scanner intent is supposed to start. But I only get an error saying that my application has stopped. The logcat messages are as follows:

03-06 20:18:58.631: D/dalvikvm(13812): Late-enabling CheckJNI
03-06 20:18:58.691: I/dalvikvm(13812): Turning on JNI app bug workarounds for target SDK version 10...
03-06 20:18:59.771: D/dalvikvm(13812): GC_FOR_ALLOC freed 57K, 3% free 8839K/9091K, paused 58ms
03-06 20:19:00.441: I/dalvikvm-heap(13812): Grow heap (frag case) to 11.692MB for 3145744-byte allocation
03-06 20:19:00.801: D/dalvikvm(13812): GC_CONCURRENT freed 1K, 3% free 11910K/12231K, paused 326ms+1ms
03-06 20:19:01.881: D/TextLayoutCache(13812): Using debug level: 0 - Debug Enabled: 0
03-06 20:19:06.201: D/dalvikvm(13812): GC_CONCURRENT freed 3118K, 25% free 9768K/12999K, paused 17ms+40ms
03-06 20:19:06.301: D/dalvikvm(13812): GC_FOR_ALLOC freed 4K, 23% free 10123K/12999K, paused 91ms
03-06 20:19:06.521: D/dalvikvm(13812): GC_FOR_ALLOC freed <1K, 20% free 10486K/12999K, paused 79ms
03-06 20:19:15.621: W/dalvikvm(13812): VFY: unable to resolve static field 1373 (ISSUE_NUMBER) in Lcom/google/zxing/ResultMetadataType;
03-06 20:19:15.621: D/dalvikvm(13812): VFY: replacing opcode 0x62 at 0x0017
03-06 20:19:15.621: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.651: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
03-06 20:19:15.651: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
03-06 20:19:15.651: I/dalvikvm(13812): Could not find method com.google.zxing.ResultPoint.getX, referenced from method com.google.zxing.client.android.CaptureActivity.drawLine
03-06 20:19:15.651: W/dalvikvm(13812): VFY: unable to resolve virtual method 3917: Lcom/google/zxing/ResultPoint;.getX ()F
03-06 20:19:15.651: D/dalvikvm(13812): VFY: replacing opcode 0x6e at 0x0000
03-06 20:19:15.651: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.651: I/dalvikvm(13812): Could not find method com.google.zxing.Result.getResultPoints, referenced from method com.google.zxing.client.android.CaptureActivity.drawResultPoints
03-06 20:19:15.651: W/dalvikvm(13812): VFY: unable to resolve virtual method 3913: Lcom/google/zxing/Result;.getResultPoints ()[Lcom/google/zxing/ResultPoint;
03-06 20:19:15.651: D/dalvikvm(13812): VFY: replacing opcode 0x6e at 0x0003
03-06 20:19:15.661: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.671: I/dalvikvm(13812): Could not find method com.google.zxing.Result.toString, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeExternally
03-06 20:19:15.671: W/dalvikvm(13812): VFY: unable to resolve virtual method 3916: Lcom/google/zxing/Result;.toString ()Ljava/lang/String;
03-06 20:19:15.671: D/dalvikvm(13812): VFY: replacing opcode 0x74 at 0x0053
03-06 20:19:15.671: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.681: I/dalvikvm(13812): Could not find method com.google.zxing.Result.getBarcodeFormat, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeInternally
03-06 20:19:15.681: W/dalvikvm(13812): VFY: unable to resolve virtual method 3910: Lcom/google/zxing/Result;.getBarcodeFormat ()Lcom/google/zxing/BarcodeFormat;
03-06 20:19:15.681: D/dalvikvm(13812): VFY: replacing opcode 0x74 at 0x004a
03-06 20:19:15.681: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.691: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.691: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.701: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.701: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.701: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.701: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.701: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.701: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.711: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.721: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.721: W/dalvikvm(13812): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
03-06 20:19:15.751: W/dalvikvm(13812): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/zxing/client/android/CaptureActivity;
03-06 20:19:15.751: W/dalvikvm(13812): Class init failed in newInstance call (Lcom/google/zxing/client/android/CaptureActivity;)
03-06 20:19:15.751: D/AndroidRuntime(13812): Shutting down VM
03-06 20:19:15.751: W/dalvikvm(13812): threadid=1: thread exiting with uncaught exception (group=0x2b542210)
03-06 20:19:15.751: E/AndroidRuntime(13812): FATAL EXCEPTION: main
03-06 20:19:15.751: E/AndroidRuntime(13812): java.lang.ExceptionInInitializerError
03-06 20:19:15.751: E/AndroidRuntime(13812):    at java.lang.Class.newInstanceImpl(Native Method)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at java.lang.Class.newInstance(Class.java:1319)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.os.Looper.loop(Looper.java:137)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at android.app.ActivityThread.main(ActivityThread.java:4441)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at java.lang.reflect.Method.invokeNative(Native Method)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at java.lang.reflect.Method.invoke(Method.java:511)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-06 20:19:15.751: E/AndroidRuntime(13812):    at dalvik.system.NativeStart.main(Native Method)
03-06 20:19:15.751: E/AndroidRuntime(13812): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
03-06 20:19:15.751: E/AndroidRuntime(13812):    at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:107)
03-06 20:19:15.751: E/AndroidRuntime(13812):    ... 15 more

有人可以帮帮我吗?我已经通过大量的帖子上了计算器,但没能找到答案。

Can somebody please help me? I have gone through numerous posts on StackOverflow but wasn't able to find an answer.

推荐答案

如果您真的要嵌入zxing,而不是它的意图整合,我建议用现成的库那你可以找到这里:https://github.com/kennydude/zxing-lib

If you really want to embed zxing instead of integrate it with an intent, I suggest to use the out of the box library that you can find here: https://github.com/kennydude/zxing-lib

正如马克建议的,最常见的方法是用其与意图的应用程序集成。

As Mark suggested, the most common approach is to integrate with their app with an intent.

这篇关于Android的ZXing集成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆