Android reports java. Io. ioexception: Permission denied

Source: Internet
Author: User
Android reports java. Io. ioexception: Permission denied
 

When writing files to sdcard.

Error reported: Android reports java. Io. ioexception: Permission denied

First, check whether your path is correct. You should write something in the directory environment. getexternalstoragedirectory.

If the path is correct, check whether the permission is added to your application. </>

 

If not, add <uses-Permission Android: Name = "android. Permission. write_external_storage"/>

If all of the above are correct, but the above errors are still met.

Check whether your AVD has set the size when it is created. If it is not set, create a new AVD with the size.

The above is a classic answer I found on the Internet. I did the first two, but I still report an error. The third item was not tested because I directly connected the mobile phone to the computer for debugging. This is exactly the problem !!! We all know that when a mobile phone is connected to a computer with a USB cable, access to the data on the SD card is forbidden, So you run yourProgram, Of course, you do not have the permission to read and write the SD card, and naturally cannot perform Io operations. Alas, after finding the problem, I feel very embarrassed, but we are constantly growing up in the second year of committing crimes. Come on!

Related Article

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.