Hello, I have disabled that permission to see if the error would happen again but it does not. Before posting I did several tests and it worked only when I set the WRITE_EXTERNAL_STORAGE permission, probably in those tests I changed something that made it work ?
Tip: the "external storage" related permissions are never needed and never help (unless you are not distributing your app through Google Play and can set targetSdkVersion to an old version).