Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Storage exception

My code was working perfectly, but today i was getting this exception, can anyone help?Log is attached Thanks

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)

here is code, which is for downloading content from firebase storage

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
    }
});
like image 898
Shahzain ali Avatar asked Dec 11 '25 14:12

Shahzain ali


1 Answers

I have fixed above problem by exceeding size in code first size was 1mb , later I increased it to 5mb.

final long ONE_MEGABYTE = 1024 * 1024;

change this to larger size like

final long ONE_MEGABYTE = 1024 * 1024 *5;
like image 86
Shahzain ali Avatar answered Dec 14 '25 14:12

Shahzain ali