Reputation: 512
I am receiving a lot of crash report as following:
Fatal Exception: java.lang.RuntimeException caused by java.lang.SecurityException
Stack trace:
Caused by java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file from pid=28628, uid=10263 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.createException(Parcel.java:1966)
at android.os.Parcel.readException(Parcel.java:1934)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderProxy.java:418)
at android.content.ContentResolver.query(ContentResolver.java:809)
at android.content.ContentResolver.query(ContentResolver.java:759)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:68)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:45)
at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:319)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:73)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:61)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
I have declared WRITE_EXTERNAL_STORAGE
and READ_EXTERNAL_STORAGE
permissions on the manifest file and took permission from the user at runtime. What else am I missing?
Note: the task was running asynchronously.
Upvotes: 0
Views: 298
Reputation: 1
you need to add android.permission.READ_EXTERNAL_STORAGE to your android manifest file or ask permission (READ_EXTERNAL_STORAGE) from user before reading external storage.
Upvotes: -1