Coding⏱️ 2 min read📅 2026-06-03

How to Fix: Storage permission error in Marshmallow

Learn how to fix: Storage permission error in Marshmallow.

Quick Answer: Try checking your system settings or restarting.

The error you're experiencing is due to the new security features in Android Marshmallow, which restricts external storage access. To fix this issue, follow these steps:

✅ Best Solutions to Fix It

Method 1: Requesting Runtime Permission

  1. Step 1: Add the following code to your activity or fragment where you're trying to access external storage:
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); } else { // You can proceed with writing to external storage here }

Method 2: Declaring Permission in AndroidManifest.xml

  1. Step 1: Add the following line to your <application> tag in your AndroidManifest.xml file:
<uses-permission android:name= 

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions