Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Android Studio recognize Base64.encodeBase64?

I'm trying run the following code, however I cannot use encodeBase64().
I've already tried to import such libraries using Alt + Enter.

enter image description here

How can I make it work?

like image 778
Daniel Avatar asked Apr 24 '15 21:04

Daniel


1 Answers

use this:

String result = Base64.encodeToString(data, Base64.DEFAULT);

instead of what you are using, i also advise you to use: .getBytes("UTF-8"); instead of data.getBytes(); UTF-8 is always a better choice. hope this will help you.

like image 59
Ahmad Sanie Avatar answered Sep 28 '22 08:09

Ahmad Sanie