Question

I'm trying to open files from C in my Android app/library. This did work at some point but stopped working after changing several things that seem completely irrelevant, and don't run until after this error occurs.

I am using the following function in C: *ppFile = fopen(fullUncFilePathAndName, "r+b"); and then again with permissions "w+b"

After each of these calls, errno = 13 (Permission Denied).

The file path is /data/data/{appFolder}/files/{filename} (got from Context.getFilesDir().getAbsolutePath(), and the working directory according to the C functions is "/". This is on internal storage, but I added the permission WRITE_EXTERNAL_STORAGE just because I had nothing else to do.

Can anyone think why reading or writing to existing and non-existent files in internal storage from an NDK library would fail with permission errors?

Was it helpful?

Solution

This problem solved itself in the best worst way possible. I deleted my app's data folder in the file browser, and then at the next build the app created its files without a hitch.

OTHER TIPS

You could also clean the project and recompile from scratch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top