open failed: ENOENT (No such file or directory)
1. Error description
The following error occurred while writing the file to sdcard:
open failed: ENOENT (No such file or directory)
2. Error analysis
At first, I thought I forgot to add read-write permission, which was checked.
Finally, when I think of android10 onwards, in addition to the dynamic application of permissions, you must add in the Application node of AndroidManifest.xml of the main application.
android:requestLegacyExternalStorage="true"
3. Solution
Add the following codes in the Application node of AndroidManifest.xml of the main application:
android:requestLegacyExternalStorage="true"