我有一个项目在较新的设备和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;
然后导致java.lang.VerifyError
类明显Card
。
问题出现在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;
现在在我的警告中。我真的很难受这一切......
答案 0 :(得分:0)
这与WriterException
无关,您不必修改代码。图书馆本身很好。你可以看到实际上很多类都缺失了,可能都是这些类。您实际上并未包含该库。既然你说你重新包装它,那就是问题所在。这些课程不在.jar
正确,或者您可能在.jar
中将其作为.jar
包含在内。