Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StorageException has occurred. Object does not exist at location. Storage FireBase

I want display image in imageView, that's what I'm doing: I'm using FirebaseUI to display images from FireBase Storage.

FirebaseStorage storageDisplayImg;
StorageReference storageRef;
private FirebaseAuth auth;



        storageDisplayImg=FirebaseStorage.getInstance();
        auth = FirebaseAuth.getInstance();
        FirebaseUser userConnect = auth.getCurrentUser();
        String id_user=userConnect.getUid();
        storageRef = storageDisplayImg.getReference().child(item.getChemin_image()); // return gs://mydreambook-32321.appspot.com/images/test23-03-2017_16:46:55

        if (item.getChemin_image() != null&&id_user != null) {

           Glide.with(convertView.getContext() )
                   .using(new FirebaseImageLoader())
                   .load(storageRef)
                   .into(profilePic);
            profilePic.setVisibility(View.VISIBLE);

        } else {
            profilePic.setVisibility(View.GONE);
        }

But I have this error:

StorageException has occurred.  Object does not exist at location.    Code: -13010 HttpResult: 404

Update , Image in storage FireBase

enter image description here

like image 318
Amal Avatar asked Mar 23 '17 16:03

Amal


3 Answers

I had the same problem right now and I realized that my image in storage ends with .jpg but my code is asking for the address that ends with .png. After I fixed that, it ran perfectly for me.

like image 133
alibabaei12 Avatar answered Sep 19 '22 20:09

alibabaei12


You can simply show the image in two ways using Glide method. If we want to access below method, we must change the Firebase Storage Rules. Here I included my rules.

service firebase.storage {
  match /b/project-id.appspot.com/o {
    match /{allPaths=**} {
      allow write: if request.auth != null;
      // or allow write: if true;
    }
  }
} 

Method 1. Simply use the Firebase Reference

FirebaseStorage storage = FirebaseStorage.getInstance();
                StorageReference storageRef = storage.getReferenceFromUrl("gs://your-id.appspot.com");
                StorageReference pathReference = storageRef.child("images/cross.png");

                Glide.with(context)
                        .using(new FirebaseImageLoader())
                        .load(pathReference)
                        .into(Imageview)

Method 2. Firebase URL

     Glide.with(context)
             .using(new FirebaseImageLoader())
             .load("Firebase_ImageURL")
             .into(Imageview)
like image 29
sivaprakash Avatar answered Sep 19 '22 20:09

sivaprakash


hi i faced such problem two days ago. storage exception occurs normally to the projects which you created with google developer console prior to Firebase launch. so when i connected my app to existing project on Firebase it worked. to confirm whether your project accepts storage or not go to Firebase console and on left click storage if you were displayed with the file upload option there the project is capable of storage other wise not.

like image 23
Iqbal Ahmad Avatar answered Sep 20 '22 20:09

Iqbal Ahmad