小编Dig*_*kur的帖子

无法解析Base64.encodeToString

我正在尝试使用以下代码在Firebase上保存图像。

  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);
Run Code Online (Sandbox Code Playgroud)

但是我面临一个错误:

cannot resolve method 'encodeToString(byte[],?)' 
cannot resolve symbol 'DEFAULT'
Run Code Online (Sandbox Code Playgroud)

如何解决此错误。

android firebase firebase-realtime-database

5
推荐指数
2
解决办法
5991
查看次数