1
votes

I am getting this exception:

StorageException has occurred. An unknown error occurred, please check the HTTP result code and inner exception for server response. Code: -13000 HttpResult: 0

while uploading an audio file to Firebase Storage from Android. And my code is:

private static StorageReference storageReference;
private static DatabaseReference mDatabase;


// inside the method

    storageReference = FirebaseStorage.getInstance().getReference();

    mDatabase = FirebaseDatabase.getInstance().getReference("Post/");
    final ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.setTitle("Uploading Preview File");
    progressDialog.show();

    StorageReference sRef = storageReference.child("rahat/");
    sRef.putFile(filePathUri)
                        .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                            @Override
                            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

                                progressDialog.dismiss();
    Toast.makeText(context, "File Uploaded ", Toast.LENGTH_LONG).show();

                                Upload upload = new Upload("Preview", taskSnapshot.getDownloadUrl().toString());

                                String uploadId = mDatabase.push().getKey();
                                mDatabase.child(uploadId).setValue(upload);
                            }
                        })
                        .addOnFailureListener(new OnFailureListener()
                        {
                            @Override
                            public void onFailure(@NonNull Exception exception) {
                                progressDialog.dismiss();
                                //Toast.makeText(context, exception.getMessage(), Toast.LENGTH_LONG).show();
                                Log.v("error", exception.toString());
                            }
                        })
                        .addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>()
                        {
                            @Override
                            public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
                                //displaying the upload progress
                                double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
                                progressDialog.setMessage("Uploaded " + ((int) progress) + "%...");
                            }
                        });

I have most recent version of Google Play Services installed on my phone.

1

1 Answers

0
votes

Just Update your version of your Firebase Storage Dependencies