I am trying to encode and decode a String using android.util.Base64, but it gives a bad base-64 error.
String str = "EOKF36syRBtB11VgyChkNjc1HxRrajT7XXaxZfnVzPkV57K3b9yqkS284Ovb9uWzXgGeY2bxA3IySGfdOHiPAQ==F/v6hcTiU1sd975XHfDsz8o0rboujM77n7KwRMidobOLbo5ghUT/IFcxElUc8CirdZxaCaS3zs/CfRKRsXwbFNYd"; Base64.decode(str,Base64.NO_WRAP); I am trying to decode the string using the following flags (NO_CLOSE, DEFAULT, NO_PADDING, URL_SAFE) but it give the same error.
Please help me to solve my problem.
Base64DecoderExceptionwith message encoded getValue has invalid trailing byte, which means that the chunk being decoded at the time isn't finalized by an equal sign (61) or new line (10) byte. If it is really worth it—or want to learn more—you can debug/breakpoint what is being done in theBase64class and also see the Base64 spec online.