我有一個項目在新設備和API級別上運行得非常好,但是,我在仿真器上遇到了一些問題。當我在模擬器上加載了程序,我碰到這個問題:無法解決異常類:ZXing
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 [email protected] (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
。現在
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;
在我警告
:將.jar列出每一個類,並會打開這一切,但我得到。我真的有了這一切難倒..
@DigCamara我聲明:android:minSdkVersion =「8」和android:targetSdkVersion =「17」 – RileyE 2013-02-23 00:04:19
@RileyE你在哪裏放置了外部jar庫? – 2013-02-23 01:45:54
SDK級別與此無關。 – 2013-02-23 07:18:23