Kategorien
Android

Apache Commons-Codec – Android compatible!

Hey everyone,

does

Could not find method org.apache.commons.codec.binary.Hex.encodeHexString,
referenced from method org.apache.commons.codec.digest.DigestUtils.shaHex

and the like sound familiar to you?

Well, the reason for these issues is that Android already interally includes an old version of Apache Commons-Codec that simply doesn’t have those methods available yet.

So, easy fix you would guess: include the latest jar file of Apache Commons-Codec and you’re ready to use all the cool stuff.

Well, unfortunately not. it seems that the internal version has a higher priority then the jars that your provide with your APK.

So, the only solution I saw to simply rename the package name of the classes and create a jar with that new package name. So I forked the commons-codec GitHub project, renamed the package name from „org.apache.commons.codec“ to „org.apache.commons.codec.android“ and the resulting jar file can easily be used within your project and you can easily use all the handy classes of Apache’s latest Commons-Codec 🙂

Check out my GitHub repo:

https://github.com/Goddchen/commons-codec

3 Antworten auf „Apache Commons-Codec – Android compatible!“

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.