Android 8.1.0 "API 27" (Permision denial: android.permission.WRITE_EXTERNAL_STORAGE don't work)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at SaveImageToFileWorker.kt line 40, where the API 27 stack trace shows the MediaStore write failing, and inspect the manifest permission declaration. Reproduce the failure on Android 8.1/API 27; done means the worker can write the image to MediaStore without the reported SecurityException.
Written by the indexing model from the issue text.
Description
I catch an error on API 27:
2022-10-05 13:49:41.061 16988-17081/com.example.background E/MediaStore: Failed to insert image
java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=16988, uid=10116 requires android.permission.WRITE_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:2013)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
at android.content.ContentResolver.insert(ContentResolver.java:1539)
at android.provider.MediaStore$Images$Media.insertImage(MediaStore.java:993)
at com.example.background.workers.SaveImageToFileWorker.doWork(SaveImageToFileWorker.kt:40)
at androidx.work.Worker$1.run(Worker.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
2022-10-05 13:49:41.061 16988-17081/com.example.background E/SaveImageToFileWorker: Writing to MediaStore failed
This permission is mensioned in manifest (see screenshot)

How to fix this error on API 27?
- Dominant language
- Kotlin
- Stars
- 557
- Forks
- 242
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/codelab-android-workmanager
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
android/codelab-android-workmanager#261 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
android/codelab-android-workmanager#324 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 50/100
All issues in android/codelab-android-workmanager
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
fwcd/tree-sitter-kotlin#289 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
navikt/syfo-oppfolgingsplan-backend#482 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
MorphiaOrg/morphia#4332 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
ooni/probe-multiplatform#1614 · 1 comment ·
Maintainers usually reply within 1 day