私は学生です。学校でのAndroidプロジェクトの一環として、バーコードアプリを含める必要があります。私は明確に与えられた指示に従いました
ZXingを統合します。CaptureActivityHandler、DecodeHandler、SearchBookContentsActivityの3つのクラスでエラーが発生しました。これらは、次のようにswitch-caseステートメントをif-elseに変更することで解決されました。
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();
}
私のアプリケーションでは、ボタンを押すと、バーコードスキャナーインテントが開始することになっています。しかし、アプリケーションが停止したというエラーが表示されるだけです。logcatメッセージは次のとおりです。
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
誰か助けてくれませんか?StackOverflowに関する多数の投稿を確認しましたが、答えを見つけることができませんでした。