我有一个项目在较新的设备和 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 来删除它。这阻止了我上面列出的那个问题(仍然不确定为什么)。然而,新的问题出现了!
我认为这可能与我的图书馆没有被正确阅读有关。我有一个用户库,core.jar
里面有 ZXing。.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;
现在在我的警告中。我真的被这一切难住了。。