Android Java.io.IOException Abnormal situation collation

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.