Android: IO file errors

Problem: on android 4.x I get weird errors while loading images:

07-23 10:31:05.961: E/XXX(32294): libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) 07-23 10:31:05.961: E/XXX(32294): open failed: ENOENT (No such file or directory) 

and sometimes:

 07-23 10:31:06.133: W/System.err(32294): java.io.IOException: open failed: ENOENT (No such file or directory) 07-23 10:31:06.133: W/System.err(32294): at java.io.File.createNewFile(File.java:940) 07-23 10:31:06.133: W/System.err(32294): at com.XXX.XXX.JSON.Media.save(Media.java:55) 07-23 10:31:06.133: W/System.err(32294): at com.XXX.XXX.JSON.Media.setFile(Media.java:78) 07-23 10:31:06.133: W/System.err(32294): at com.XXX.XXX.ServerAccess.AsyncDownloadQueue$QueueMedia.isDone(AsyncDownloadQueue.java:257) 07-23 10:31:06.133: W/System.err(32294): at com.XXX.XXX.ServerAccess.AsyncDownloadQueue.doInBackground(AsyncDownloadQueue.java:102) 07-23 10:31:06.133: W/System.err(32294): at com.XXX.XXX.ServerAccess.AsyncDownloadQueue.doInBackground(AsyncDownloadQueue.java:1) 07-23 10:31:06.133: W/System.err(32294): at com.XXX.Library.Threading.AsyncTask$2.call(AsyncTask.java:189) 07-23 10:31:06.133: W/System.err(32294): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 07-23 10:31:06.133: W/System.err(32294): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 07-23 10:31:06.133: W/System.err(32294): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 07-23 10:31:06.133: W/System.err(32294): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 07-23 10:31:06.133: W/System.err(32294): at java.lang.Thread.run(Thread.java:856) 07-23 10:31:06.133: W/System.err(32294): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) 07-23 10:31:06.141: W/System.err(32294): at libcore.io.Posix.open(Native Method) 07-23 10:31:06.141: W/System.err(32294): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) 07-23 10:31:06.141: W/System.err(32294): at java.io.File.createNewFile(File.java:933) 07-23 10:31:06.141: W/System.err(32294): ... 11 more 

So, the weird bit ... it works on Android 2.2, and it works SOMETIMES with the image here and there on 4.x. The exact same upload procedure will download one file, but not the other. Are there restrictions on multi-threaded access? Each stream is attached to a unique file, so I don’t think the problem is; nothing is read from the file that is written to.

Oh, and that should not be a resolution issue:

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" /> <uses-permission android:name="android.permission.INTERNET" /> 
+6
source share

Source: https://habr.com/ru/post/921139/


All Articles