I'm having the following problem. I've created a new version of an app that requires to read a file (that exists). Partial logcat output:
W/System.err: File /storage/emulated/0/ccrypt/data.aux exists.
Also here is the code that prints this:
System.err.println("File " + dataFile + " exists.");
System.err.println("R: " + file.canRead() + ". W: " + file.canWrite());
file.setReadable(true);
file.setWritable(true);
System.err.println("R: " + file.canRead() + ". W: " + file.canWrite());
The problem is that the output from the above code is:
W/System.err: R: false. W: false
W/System.err: R: false. W: false
So whenever I try to read it, I get the permission denied error. I have added these two lines at the bottom of my manifest file:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
What could be the problem? Why am I not able to read/write the file?