listAll() does not work for firebase in Android

Tags: , , ,

i have created a function to list all files with in a reference.mStorageRef is defined public.

 public void ListFiles()
        mStorageRef = FirebaseStorage.getInstance().getReference("ImageFolder");

                .addOnSuccessListener(new OnSuccessListener<ListResult>() {
                    public void onSuccess(ListResult listResult) {
                        for (StorageReference prefix : listResult.getPrefixes()) {
                            Log.d("Storage_Prefix :",prefix.getName());

                       /* for (StorageReference item : listResult.getItems()) {

                .addOnFailureListener(new OnFailureListener() {
                    public void onFailure(@NonNull Exception e) {
                        Log.d("FETCHING_DATA_STATUS","Failed due to"+e.getMessage());
                }).addOnCompleteListener(new OnCompleteListener<ListResult>() {
            public void onComplete(@NonNull Task<ListResult> task) {
                if(task.isSuccessful()) {
                    Log.d("FETCHING_DATA_STATUS", "FINISHED");


but when i execute this i get following ouput:

W/StorageUtil: no auth token for request
W/NetworkRequest: no auth token for request
W/example.larn: Checksum mismatch for dex base.apk!classes2.dex
    Could not merge the profile. Clearing the profile data.

how can i use list all correctly.Please help


You’re looping over listResult.getPrefixes(), which are the subfolders in your ImageFolder.

Since you indicate you want to list files, you should loop over listResult.getItems() instead.

I find keeping the reference documentation open key to quickly fixing this sort of common mistake.

Source: stackoverflow