File Delete no longer works - Android

Lloyd Sheen 1,391 Reputation points
2022-03-03T16:15:49.36+00:00

All of a sudden the File.Delete method no longer works on Android.

            File.Delete(theFileName);
            fileExists = ApiGeneralRoutines.doesFileExist(theFileName);

Using the above code the File.Delete executes and when I check to see if the file still exists it does.

Confused!

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,301 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rijwan Ansari 746 Reputation points MVP
    2022-03-04T08:31:01.507+00:00

    Hi @Lloyd Sheen

    Sometimes this happens because of permissions as well. You can modify Manifest to get permission.

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>  
    

    Also verify the path before deleting.

    0 comments No comments