I have been trying to get ez-vcard to work on Android but I am running into an unfortunate circumstance.
For the most part ez-vcard was working fine on Android, but with certain vCards, I was getting the following error:
06-04 11:38:08.586: E/AndroidRuntime(1694): java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.types.BinaryType.parse(BinaryType.java:467)
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.types.BinaryType.doUnmarshalText(BinaryType.java:331)
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.types.VCardType.unmarshalText(VCardType.java:279)
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.io.VCardReader.readNext(VCardReader.java:355)
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.Ezvcard$ParserChain.first(Ezvcard.java:697)
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.Ezvcard$ParserChainText.first(Ezvcard.java:752)
06-04 11:38:08.586: E/AndroidRuntime(1694): at ezvcard.Ezvcard$ParserChainTextString.first(Ezvcard.java:834)
Turns out that since Android has Apache Commons Codec 1.2, we are missing some of the functions that ez-vcard needs. See:
http://stackoverflow.com/questions/2047706/apache-commons-codec-with-android-could-not-find-method?rq=1
And it does not seem like we can force Android to use a higher version. Has anyone run into this issue before and what was the solution?
Is there a build of ez-vcard that can work around this issue?
Any help is appreciated!
Sorry, I also should have mentioned in the original post that I was using the ez-vcard JAR without any dependencies in it (I added them all into my project except commons-codec).
One thing I tried doing was renaming the commons codec library (meaning there is the old Android library and the newly renamed one). I then changed the import statements on the ez-vcard source and it seems to have addressed this issue, but this seems like more of a workaround than an actual solution.
By the way, thank you Mike for developing this library. I have found it very useful!
Have you tried including the commons-codec JAR in your project? It may override Android's version.
Thanks, and thanks for your feedback. I needed more info on how well ez-vcard works with Android (apparently, the answer is "not so well").
I've released a new version that contains this fix. Thanks for letting me know about it.
-Mike