我从Eclipse中使用的外部库中获取NoSuchMethodError。我正在尝试使用获取VCard数据并对其进行解码的解析器 this库,附带所有依赖项(包括下面logcat中提到的包)。我已经通过Build Path将所有依赖项添加到Eclipse中的References Libraries - >添加外部JAR。但是每当我运行我的代码时,我都会得到:
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.
事实上,我已经检查了我的References Libraries中的org.apache.commons.codec.binary包,并且Base64.decodeBase64方法肯定存在。是什么给了什么?
答案 0 :(得分:1)
从other similar questions的答案来看,Android似乎包含必须首先出现在类路径上的1.2 commons编解码器库。该版本不包含byte[]
方法的decodeBase64
版本。
一种可能的解决方案是更改EZVCard源(因为它是开源的)来调用基于String
的方法。