I have a common library that I use for both Java and Android projects and it requires a base64 encoder/decoder. The trouble is, the Apache commons library does not work with Android, at least not that I have been able to successfully implement – due to Android already implementing and earlier version and thus causing an error at run time whenever I attempt to encode or decode:
Base64.decodeBase64
Returns the error:
AndroidRuntime(1420): java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64
If anyone knows of a base64 library that is compatible with both Java and Android, or can explain to me how to get around the Apache commons issue, I would be very grateful. :^)
There’s just “base64”. It so trivial that you can google for any “java base64” and use any implementation.
EDIT
If you target pre API8, simply grab the source from Base64 implementation from API8 (it is android/util/Base64.java) and copy into your project.