Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Android 8.1.0 "API 27" (Permision denial: android.permission.WRITE_EXTERNAL_STORAGE don't work)

Open
#307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, kotlin
Domain
mobile

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/codelab-android-workmanager

All issues in android/codelab-android-workmanager

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.