2

Since updating to Android O (8.1.0) on our development Nexus 5x phones, we have been seeing a lot of weird file access issues. We have 1 file that keeps coming up, no reason why this file, but I'm positive the file is in /sdcard/ , I use Java or C++ (NDK) to see if the file exists, but it returns that the file doesn't exist. I can try this 100 times, and maybe 1 time it fails, maybe 10 times it fails. I have this across 5-6 devices, so it's not just 1 device.

Has anyone seen anything like this before? We've deleted the files and have them re-downloaded. This file is for a 3rd party library, we have wondered if there is a file lock, but this file is accessed at startup, so we swipe the app away, restart and right away we can't view the file.

C++ Example:

   return (access(aFileName.c_str(), F_OK) != -1);

Java Example:

File lTempTaskFile = new File(lTaskFileName);
if(lTempTaskFile.exists())
{
    // blah
}
Brian S
  • 3,096
  • 37
  • 55
  • You will have much better luck with a [mcve]. You might also wish to clarify whether "the sdcard" means [external storage](https://commonsware.com/blog/2017/11/14/storage-situation-external-storage.html) or [removable storage](https://commonsware.com/blog/2017/11/15/storage-situation-removable-storage.html). – CommonsWare Feb 14 '18 at 15:38
  • I just don't understand the need to run around downvoting questions, I have a number of co-workers who refuse to post to SO because they are afraid that no matter how much effort they put in it will be downvoted. Can you expand on what type of examples you would want to see? It's a very intermittent issue, where I can add detail about what the file name is, the precise folder that I'm trying to access, but that seems like added reading that most likely does not clarify what the issue is. – Brian S Feb 14 '18 at 15:41
  • 1
    I did not downvote your question. I posted a comment. The example would be the code that is accessing the file that is triggering whatever the problem is. If the problem is an exception, the stack trace would be useful. – CommonsWare Feb 14 '18 at 15:43
  • Sorry the downvote was a blanket statement, because I jumped on and someone had already downvoted it, and since you had taken the time to comment I wrongly assumed you. In my mind it's even worse then that someone just flew through, hit downvote and didn't explain why so I could improve the question. – Brian S Feb 14 '18 at 15:44
  • 1
    I'm having the same issue! – nverbeek Feb 14 '18 at 15:57

0 Answers0