-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Android] Cannot write new files to storage in AVD emulator #231
Comments
@BrendanFDMoore , did you create the folder |
@wkh237 While I do not create it immediately prior to downloading, the directory of the target path already exists, and contains other test files. Using I double checked that I hadn't made an error assuming the |
So, before you posted this I had a theory, and it turns out my theory was at least partially right. This is something related to the particular directory of this particular image. I think it is directory permissions related, but I don't know specifically why. I'll try to describe to help you understand if there is a useful error case to detect here. I am actually using a sub-directory of When I was setting up my test data, the I just created a different directory under So, I can write files in general, and my issue is different than I understood 24h ago. I cannot write files to directories that were created using Sorry that ended up much longer than expected, but I'm just writing this up as I'm discovering the more specific problem. I think I can now work around my specific issue, but I'm happy to help test if you think |
Ah, it's most likely the ownership. Using Is this something that I also find it interesting that I was able to overwrite files that have |
Thanks so much for the detailed information, IMO if the error only happens on the files created by |
Yes, I can correct the issue with any of the following from
Where Then just look at the value in @wkh237 - I've resolved my issue, so feel free to close this. I think it would be better if |
Hi there,
Thanks for maintaining this package with great API docs and examples. It's amazingly helpful.
While trying to implement file download functionality I encountered some frustrating behaviour I cannot explain while running a virtual android device: I can't write new files. Worse,
react-native-fetch-blob
thinks it can write the file, reports no error, and responds with the expected path. But the file isn't written there. Overwriting an existing file works fine, so this isn't strictly a write permission issue. This problem does not happen when running on a real device.Action:
Try to download a file to the local
DocumentDirectory
on a virtual/emulated Android device as followswhich yields the expected output of:
RNFetchBlob result /data/user/0/com.myappname/files/123.mp3
and no errors.Expected result:
Actual Result:
Other Considerations:
WRITE_EXTERNAL_STORAGE
permission inAndroidManifest.xml
and on startup I verify the permission explicitly viaPermissionsAndroid.checkPermission(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE)
which returnstrue
as expected.path
that already exists, the downloaded file will replace the pre-existing file.Target SDK: 23
Android Device & Version: Nexus 5X @ 6.0
RN: 0.34.1
RNFB: 0.10.2-beta.3
The text was updated successfully, but these errors were encountered: