I had the same problem, the delete () method returned false for my file.
In my case, somewhere between creating the file, writing to the FileOutputStream file and deleting the file, I used FileInputStream and forgot to call the close () function on it.
So, perhaps somewhere in your code you added another stream to this file and left it open.
Before finding the real source of the problem, I used the simle firmware to temporarily fix this:
FileOutputStream fos = new FileOutputStream(myFile); fos.close(); myFile.delete();
Right before calling delete in my File, I created another FileOutputStream above it, and then just called close ().
This unlocks all prevailing locks in this file and allows you to call delete ().
However, this is not a good practice. You should find out who is using your file and how to solve it correctly.
source share