Storage permission error in Marshmallow

You should be checking if the user has granted permission of external storage by using: if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { Log.v(TAG,”Permission is granted”); //File write logic here return true; } If not, you need to ask the user to grant your app a permission: ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CODE); Of course these are for marshmallow devices … Read more