无法解决exception类:ZXing

我有一个项目在较新的设备和API级别上运行得非常好,但是,我在模拟器上遇到了一些问题。 当我在模拟器上加载应用程序时,我遇到了这个问题:

02-22 18:36:11.584: W/dalvikvm(652): VFY: unable to resolve exception class 872 (Lcom/google/zxing/WriterException;) 02-22 18:36:11.584: W/dalvikvm(652): VFY: unable to find exception handler at addr 0x7da 02-22 18:36:11.584: W/dalvikvm(652): VFY: rejected Lcom/example/myapp/Card;.getFrontView (Landroid/content/Context;)Landroid/widget/LinearLayout; 02-22 18:36:11.584: W/dalvikvm(652): VFY: rejecting opcode 0x0d at 0x07da 02-22 18:36:11.584: W/dalvikvm(652): VFY: rejected Lcom/example/myapp/Card;.getFrontView (Landroid/content/Context;)Landroid/widget/LinearLayout; 02-22 18:36:11.584: W/dalvikvm(652): Verifier rejected class Lcom/example/myapp/Card; 

这导致了Card类的明显java.lang.VerifyError

问题出现在WriterException类中,但该类只是:

 /* * Copyright 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.zxing; /** * A base class which covers the range of exceptions which may occur when encoding a barcode using * the Writer framework. * * @author dswitkin@google.com (Daniel Switkin) */ public final class WriterException extends Exception { public WriterException() { } public WriterException(String message) { super(message); } public WriterException(Throwable cause) { super(cause); } } 

也许我错过了为什么这会导致较旧的API级别出现问题,但这就是为什么我在这里问这个问题! 我很欣赏SO的集体和大众知识。

编辑:

我尝试通过在更深层次的内部处理它来删除抛出的WriterException。 这阻止了我上面列出的问题(仍然不确定原因)。 但是,出现了一个新问题!

我认为这可能与我的图书馆没有正确阅读有关。 我有一个带有ZXing core.jar的用户库。 .jar列出了每个类,并将打开它,但我得到:

 02-22 18:56:49.564: W/dalvikvm(688): VFY: unable to find class referenced in signature (Lcom/google/zxing/BarcodeFormat;) 02-22 18:56:49.604: E/dalvikvm(688): Could not find class 'com.google.zxing.EncodeHintType', referenced from method Barcode.BarcodeGenerator.encodeAsBitmap 02-22 18:56:49.604: W/dalvikvm(688): VFY: unable to resolve const-class 869 (Lcom/google/zxing/EncodeHintType;) in LBarcode/BarcodeGenerator; 02-22 18:56:49.604: D/dalvikvm(688): VFY: replacing opcode 0x1c at 0x0011 02-22 18:56:49.604: E/dalvikvm(688): Could not find class 'com.google.zxing.MultiFormatWriter', referenced from method Barcode.BarcodeGenerator.encodeAsBitmap 02-22 18:56:49.604: W/dalvikvm(688): VFY: unable to resolve new-instance 870 (Lcom/google/zxing/MultiFormatWriter;) in LBarcode/BarcodeGenerator; 

在我的警告现在。 我真的很难过这一切……

这是用户库的屏幕截图,名为ZXing,我已添加到项目的Java Build Path> Libraries中。

它与WriterException ,您不必修改代码。 图书馆本身很好。 你可以看到实际上很多类都缺失了,可能都是这些类。 您实际上并未包含该库。 既然你说你重新包装它,问题就出现了。 这些类没有正确地放在.jar ,或者你可能将它包含在.jar中的.jar