Firebase
gives -13000 StorageException when i try to upload a file at a location which doesn't exists.
Example :
root/abc/cba/pqr/test_file.txt
but root/test_file.txt and root/abc/test_file.txt both work fine
final File file = new File("local/file_path.txt");
StorageReference remoteLocation = FirebaseStorage.getInstance().getReference();
StorageReference currentFileRef = remoteLocation.child("abc/cba/pqr/test_file.txt");
StorageTask task = currentFileRef.putFile(Uri.fromFile(file))
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
String log = "File " + file.getName() + " uploaded successfully !";
uploadLog(log);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
String log = "File " + file.getName() + " upload Error : "+exception.getClass().getSimpleName()+" " + exception.getCause()+" "+exception.getLocalizedMessage()+" " +exception.getMessage();
if (exception instanceof StorageException){
log+= " "+((StorageException)exception).getErrorCode();
log+= " "+((StorageException)exception).getHttpResultCode();
}
uploadLog(log);
Log.d(TAG,log);
}
});
I have updated version of google play services and all the required permissions.