When the Uri content://com.android.externalstorage.documents/tree/primary%3A/document/primary%3A is fed into FileUtils#getPath, an ArrayIndexOutOfBoundsException is raised, because the docId for this URI is "primary:" and thus splitting this id on ":" gives an array with length 1
When the Uri content://com.android.externalstorage.documents/tree/primary%3A/document/primary%3A is fed into FileUtils#getPath, an ArrayIndexOutOfBoundsException is raised, because the docId for this URI is "primary:" and thus splitting this id on ":" gives an array with length 1
The following fixes the problem: