sha*_*ali 0 android firebase firebase-storage
我的代码工作得很完美,但今天我得到了这个例外,有人可以帮忙吗?日志附上谢谢
10-03 13:33:50.141 15352-17764/com.shahzain.ada E/StorageException: StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 200
10-03 13:33:50.141 15352-17764/com.shahzain.ada E/StorageException: the maximum allowed buffer size was exceeded.
java.lang.IndexOutOfBoundsException: the maximum allowed buffer size was exceeded.
at com.google.firebase.storage.StorageReference$5.doInBackground(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask$8.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
10-03 13:33:50.141 15352-17764/com.shahzain.ada E/StorageException: StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 200
10-03 13:33:50.141 15352-17764/com.shahzian.ada E/StorageException: the maximum allowed buffer size was exceeded.
java.lang.IndexOutOfBoundsException: the maximum allowed buffer size was exceeded.
at com.google.firebase.storage.StorageReference$5.doInBackground(Unknown Source)
at com.google.firebase.storage.StreamDownloadTask.run(Unknown Source)
at com.google.firebase.storage.StorageTask$8.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Run Code Online (Sandbox Code Playgroud)
这是代码,用于从firebase存储下载内容
final long ONE_MEGABYTE = 1024 * 1024;
islandRef.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() {
@Override
public void onSuccess(byte[] bytes) {
// Data for "images/island.jpg" is returns, use this as needed
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});
Run Code Online (Sandbox Code Playgroud)
我已经通过超出代码的大小修复了上面的问题,第一个大小是1mb,后来我把它增加到5mb.
final long ONE_MEGABYTE = 1024 * 1024;
Run Code Online (Sandbox Code Playgroud)
将此更改为更大的尺寸
final long ONE_MEGABYTE = 1024 * 1024 *5;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1320 次 |
| 最近记录: |