Android – cannot resolve base64.encodetostring
•
Android
I'm trying to save an image on firebase using the following code
Bitmap bm = BitmapFactory.decodeFile(imgDecodableString);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG,100,baos);
byte[] byteArray = baos.toByteArray();
String encodedImage = Base64.encodeToString(byteArray,Base64.DEFAULT);
But I face a mistake:
cannot resolve method 'encodeToString(byte[],?)'
cannot resolve symbol 'DEFAULT'
How to resolve this error
resolvent:
I think you imported org.apache.commons.codec.binary.base64 in the file. Please recheck and try to use import android.util.base64. It will solve the problem that you cannot solve the method 'encodetostring (byte [],?)'
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码