0

我从我在 Eclipse 中使用的外部库中获得了 NoSuchMethodError。我正在尝试运行一个解析器,它使用 这个库来获取 VCard 数据并对其进行解码,该库附带了它的所有依赖项(包括下面 logcat 中提到的包)。我已经通过 Build Path -> Add External JARs 将所有依赖项添加到 Eclipse 中的 References Libraries。但是,每当我运行我的代码时,我都会得到:

06-02 11:08:53.126: I/dalvikvm(7576): Could not find method org.apache.commons.codec.binary.Base64.decodeBase64, referenced from method ezvcard.types.BinaryType.parse
06-02 11:08:53.126: W/dalvikvm(7576): VFY: unable to resolve static method 12383: Lorg/apache/commons/codec/binary/Base64;.decodeBase64 (Ljava/lang/String;)[B
06-02 11:08:53.126: D/dalvikvm(7576): VFY: replacing opcode 0x71 at 0x003c
06-02 11:08:53.137: I/dalvikvm(7576): Could not find method org.apache.commons.codec.binary.Base64.decodeBase64, referenced from method ezvcard.types.BinaryType.cannotUnmarshalValue
06-02 11:08:53.146: W/dalvikvm(7576): VFY: unable to resolve static method 12383: Lorg/apache/commons/codec/binary/Base64;.decodeBase64 (Ljava/lang/String;)[B
06-02 11:08:53.146: D/dalvikvm(7576): VFY: replacing opcode 0x71 at 0x0018
06-02 11:08:53.426: D/dalvikvm(7576): GC_CONCURRENT freed 295K, 12% free 3846K/4328K, paused 4ms+3ms, total 64ms
06-02 11:08:53.426: D/dalvikvm(7576): WAIT_FOR_CONCURRENT_GC blocked 30ms
06-02 11:08:53.486: D/AndroidRuntime(7576): Shutting down VM
06-02 11:08:53.496: W/dalvikvm(7576): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
06-02 11:08:53.546: E/AndroidRuntime(7576): FATAL EXCEPTION: main
06-02 11:08:53.546: E/AndroidRuntime(7576): java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64
06-02 11:08:53.546: E/AndroidRuntime(7576):     at ezvcard.types.BinaryType.parse(BinaryType.java:467)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at ezvcard.types.BinaryType.doUnmarshalText(BinaryType.java:331)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at ezvcard.types.VCardType.unmarshalText(VCardType.java:279)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at ezvcard.io.VCardReader.readNext(VCardReader.java:355)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at com.lim.json.VCardActivity.getVCard(VCardActivity.java:76)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at com.lim.json.VCardActivity.onCreate(VCardActivity.java:54)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.Activity.performCreate(Activity.java:5104)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.os.Looper.loop(Looper.java:137)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at android.app.ActivityThread.main(ActivityThread.java:5041)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at java.lang.reflect.Method.invokeNative(Native Method)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at java.lang.reflect.Method.invoke(Method.java:511)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-02 11:08:53.546: E/AndroidRuntime(7576):     at dalvik.system.NativeStart.main(Native Method)
06-02 11:12:04.456: I/Process(7576): Sending signal. PID: 7576 SIG: 9
06-02 11:12:05.136: E/Trace(7639): error opening trace file: No such file or directory (2)
06-02 11:12:05.666: D/gralloc_goldfish(7639): Emulator without GPU emulation detected.
06-02 11:12:06.276: D/dalvikvm(7639): GC_FOR_ALLOC freed 92K, 8% free 2675K/2888K, paused 56ms, total 66ms
06-02 11:12:06.286: I/dalvikvm-heap(7639): Grow heap (frag case) to 3.333MB for 635812-byte allocation
06-02 11:12:06.346: D/dalvikvm(7639): GC_FOR_ALLOC freed 6K, 7% free 3290K/3512K, paused 50ms, total 50ms
06-02 11:12:06.427: D/dalvikvm(7639): GC_CONCURRENT freed 1K, 6% free 3308K/3512K, paused 19ms+13ms, total 87ms
06-02 11:12:06.676: I/Choreographer(7639): Skipped 44 frames!  The application may be doing too much work on its main thread.

问题是,我已经检查了我的参考库中的 org.apache.commons.codec.binary 包,并且 Base64.decodeBase64 方法肯定存在。是什么赋予了?

4

1 回答 1

1

其他类似 问题的答案来看,Android 似乎包含 1.2 commons 编解码器库,该库必须首先出现在类路径中。该版本不包括该方法的byte[]版本decodeBase64

一种可能的解决方案是更改 EZVCard 源(因为它是开源的)以调用String基于方法。

于 2013-06-02T11:48:38.103 回答