Actually, I am developing an Android Application with encryption. When I use the Base64 for encoding and decoding, I receive an error of
Java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String()
at run-time.
I know there are some posts on Stackflow which has been discussed the main cause of the problem ==> there are different versions of commons-codec.
Could anybody describe how to solve this problem in details? (So far, I know two solutions are workable).
1) Import the org.apache.commons.codec.binary.Base64
as client named package.;
2) Update the default lib of commons-codec)
Currently, I am using adt-bundle-windows-x86-20131030 for developing my application. Here is some of the coding for reference.
import org.apache.commons.codec.binary.Base64;
public static String receiveSetup(String messageFromActivity)
throws Exception {
SecretKey tempKey2 = DES.loadKey();
byte[] test2 = Base64.decodeBase64(messageFromActivity);
byte[] printString = DES.decrypt(test2, tempKey2);
String str = new String(printString, "UTF-8");
return str;
}