react-native-fs: ENOENT: open failed: EACCES (Permission denied), open '/storage/emulated/0/Download/
I encountered this issue so I am writing this just to tell everyone how to fix this permission issue in android
I have added permissions in manifest file
....
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> // worked without this also
...
<application ...
android:requestLegacyExternalStorage="true" // this is needed
....
>
Also don’t forget to ask for permission
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
{
title: "Cool Photo App Camera Permission",
message:
"Your app needs permission.",
buttonNeutral: "Ask Me Later",
buttonNegative: "Cancel",
buttonPositive: "OK"
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
return true;
} else {
console.log("Camera permission denied");
return false;
}
} catch (err) {
console.warn(err);
return false;
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 49
- Comments: 20
<application … android:requestLegacyExternalStorage=“true” … I make this change but still issue is there it gives me error like ENOENT: open failed: EACCES (Permission denied), open ‘/storage/emulated/0/Download/config.txt’
android:requestLegacyExternalStorage=“true” not working api level 30
android\app\build\intermediates\merged_manifests\debug\arm64-v8a\AndroidManifest.xml:27: AAPT: error: attribute android:requestLegacyExternalStorage not found.
has error
thanks worked for me as well. just do not forget to rebuild the app.
Add this and rebuild the app
<application … android:requestLegacyExternalStorage=“true” … I make this change but still issue is there it gives me error like ENOENT: open failed: EACCES (Permission denied), open ‘/storage/emulated/0/Download/config.xlsx’
<application … android:requestLegacyExternalStorage=“true” // this is needed …
work for me
It solved when restarted the app