PrefaceMost of the projects on Android are still developed by Java, and one of the most common exceptions in Java is java.io.IOException, which we often encounter in Android development, Here are some of the common ioexception in the Android implementation, but in practice, the cause of ioexception anomalies may be various, here I only organized a few, welcome message to discuss.
Open failed:eacces (Permission denied)
According to the error message, we can know that there are several ways to solve this problem:
1. Add <uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAG"/> permission in Androidmainfest.xml;
2. If not, try adding <uses-permission android:name= "android.permission.MOUNT_UNMOUNT_" to the Androidmainfest.xml. Filesystems "/> Permission;
3. Note the write location of the permissions in the Androidmainfest.xml file: should be the same level as the <application> tag node, not the <application> tag, so that the permissions will not be effective;
4. There is an exception I found in the data, some mobile phone in the disk mode connection to the computer, the mobile phone will temporarily lose access to sdcard/external memory read and write permissions, then open the mobile app will occur this privilege abnormal ioexception.
Open Failed:eisdir (is a directory)
This exception indicates that the program should operate on a file and that you are passing in a Folder object.
java.ioException:No such file or directoryindicates that the program specifies that the file read or write does not exist, or that the directory and files do not have read and write permissions, for example: The app has its own/data/data/packagename/directory and file read and write permissions, and the other packages under the directory and files are not read and write permission, Unless your app gets root privileges.