Reputation: 890
I have been getting a NoSuchMethodError from an external library that I am using in Eclipse. I'm trying to run a parser that gets VCard data and decodes it, using this library, which ships with all its dependencies (including the packages mentioned in the logcat below). I have added all of the dependencies to my References Libraries in Eclipse via Build Path -> Add External JARs. However whenever I run my code, I get:
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.
Thing is, I have checked the org.apache.commons.codec.binary package in my References Libraries and the Base64.decodeBase64 method certainly exists. What gives?
Upvotes: 0
Views: 1213
Reputation: 6718
From the answers to other similar questions, it would appear that Android includes the 1.2 commons codec library which must appear first on the classpath. That version does not include the byte[]
version of the decodeBase64
method.
One possible solution would be to change the EZVCard source (since it is open source) to call the String
based method instead.
Upvotes: 1