StorageException has occurred. Object does not exist at location
<p>Im' using FirebaseUI with Recycler View and load images from Firebase Storage. I got an error above when I'm trying to replace the image with another one.</p>

<p>When I exit the fragment and back again, the image shows up, the error occurs in the same fragment where I'm changing the image.</p>

<p>I tried to use <code>adapter.wait()</code> and <code>adapter.notifyDataSetChanged()</code> but still get that error. The full error is this:</p>

<pre><code>E/StorageException: StorageException has occurred.
                Object does not exist at location.
                 Code: -13010 HttpResult: 404
E/StorageException: {  "error": {    "code": 404,    "message": "Not Found.  Could not get object"  }}
                java.io.IOException: {  "error": {    "code": 404,    "message": "Not Found.  Could not get object"  }}
                    at bvk.a(:com.google.android.gms.DynamiteModulesC:424)
                    at bvk.a(:com.google.android.gms.DynamiteModulesC:1404)
                    at bve.onTransact(:com.google.android.gms.DynamiteModulesC:53)
                    at android.os.Binder.transact(Binder.java:380)
                    at com.google.android.gms.internal.zzans$zza$zza.zzuj(Unknown Source)
                    at com.google.android.gms.internal.zzanv.zza(Unknown Source)
                    at com.google.android.gms.internal.zzanm.zza(Unknown Source)
                    at com.google.android.gms.internal.zzanm.zzd(Unknown Source)
                    at com.google.firebase.storage.zzb.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)
</code></pre>

<p>And my code is this:</p>

<pre><code> protected void populateViewHolder(final ReportViewHolder viewHolder, final Report report, final int position) {

            viewHolder.txtTitle.setText(report.title);
            viewHolder.txtMessage.setText(report.message);
            viewHolder.txtDate.setText(report.date);
            viewHolder.txtuserName.setText(report.userName);
            viewHolder.btnImg.setImageBitmap(null);


                mStorage.child("Images/" + report.key + "/" + report.imageName).getDownloadUrl().addOnSuccessListener(new OnSuccessListener&lt;Uri&gt;() {
                @Override
                public void onSuccess(Uri uri) {
                     Picasso.with(getContext()).load(uri).into(viewHolder.btnImg);
                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception exception) {
                    // Handle any errors
                }
            });


  btnUpdate.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            final String Title=title.getText().toString();//get text from EditText
                            final String msg= message.getText().toString();
                            Query query= mDatabaseReference.child("user-reports/"+userID).orderByKey().equalTo(report.key);

                            query.addListenerForSingleValueEvent(new ValueEventListener() {
                                @Override
                                public void onDataChange(DataSnapshot dataSnapshot)
                                {
                                    for (DataSnapshot snapshot: dataSnapshot.getChildren())
                                    {
                                        snapshot.getRef().setValue(new Report(report.userName,report.date, Title, msg, report.key,
                                                targetUri.getLastPathSegment()));

                                        update_img(report.key, report.imageName);

                                        mDatabaseReference.child("reports/"+ report.key).setValue(new Report(report.userName,report.date, Title, msg, report.key,
                                                targetUri.getLastPathSegment()));

                                        dialog.dismiss();
                                    }
                                }

                                @Override
                                public void onCancelled(DatabaseError databaseError) {

                                }
                            });

                        }
                    });
</code></pre>

<p>And the function to update is this:</p>

<pre><code>public void update_img(String key, String imageName)
{
    //  Get the data from an ImageView as bytes
    imgView.setDrawingCacheEnabled(true);
    imgView.buildDrawingCache();
    Bitmap bitmap = imgView.getDrawingCache();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
    byte[] data2 = baos.toByteArray();

    AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    builder.setCancelable(false);
    final View view = inflater.inflate(R.layout.progbar, null);
    builder.setView(view);
    TextView progTitle = (TextView) view.findViewById(R.id.progTitle);
    progTitle.setText("wait to update");

    final Dialog progDialog = builder.create();
    progDialog.show();

    if(targetUri != null) {


        mStorage.child("Images/" + key + "/" + imageName).delete(); // Delete the old image of the user
        StorageReference filepathRef = mStorage.child("Images/"+ key).child(targetUri.getLastPathSegment()); // Add the new image of the user

        UploadTask uploadTask = filepathRef.putBytes(data2);
   uploadTask.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception exception) {
                // Handle unsuccessful uploads
            }
        }).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {


                progDialog.cancel();
                Toast.makeText(getContext(), "success", Toast.LENGTH_SHORT).show();
            }
        });

    }
}
</code></pre>

<p>Hope you know what to do, because I really don't know what else I can do.</p>