title: lstat failed: Device or resource busy - Failed to create package folder after a Clear Data on the app
body: <p>Scenario: After running my app once, I go into the Settings->Apps->App and click Clear Data. Upon trying to run the app again it fails to restore some required files for the app to run properly. The call to context.getExternalFilesDir(null) returns a null pointer. Attempting to create a file using the null pointer tries to create the file in the root folder (ie: "\myFileName.txt") which is not where I want the files to go and a read only part of the system.</p>
  
  <p>After looking through numerous questions on here I can cross of that</p>
  
  <ul>
  <li>This is not a permission issue, if I do not clear the data I can write files till my hearts content.</li>
  <li>This also does not seem to be a 'we have left a lock or reference to the file' issue as the folder does not exist, I am not getting a lstat error and lsof is listing no files, even if I can not follow the links, under my package's name.</li>
  </ul>
  
  <p>When I start the app the second time and it fails to write the files because of the null pointer, the system is left in its broken state and only a device reset appears to fix it. If I browse to the Android/data folder in an android file explorer I see a file, not a folder, called 'com.myapps.packag' there. But it has no associated information (It shows up as a ? icon, 0.00B in size, -rw for its stats and no date created/updated.. this looks like empty default information to me).</p>
  
  <p>If I browse into the folder via ADB shell access and do an ls -al on the data folder I get the error in the title:</p>
  
  <pre><code>lstat 'com.myapps.package' failed: Device or resource busy
  </code></pre>
  
  <p>and that is it.</p>
  
  <p>lsof reports no files open by anything under the packages name. Trying to scan the list of files seems fairly useless as most of them will not resolve (My device is not rooted so I can not get root access to have it display the information properly).</p>
  
  <p>Basically I am at the end of things I could find on here and through Google to try out and see why the second running of the app appears to be failing to create its package folder.</p>
  
  <p>Oh, if it matters I am using Android OS 4.2.2 (API 17)</p>