Dig*_*kur 5 android firebase firebase-realtime-database
我正在尝试使用以下代码在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)
如何解决此错误。
小智 7
我认为您在文件中导入了org.apache.commons.codec.binary.Base64,请重新检查,然后尝试使用import android.util.Base64。它将解决您无法解决方法'encodeToString(byte [] ,?)'的问题。
| 归档时间: |
|
| 查看次数: |
5991 次 |
| 最近记录: |