android / android/codelab-android-datastore

CRASH: Unable to delete SharedPreferences: prefs_name

Open
#36 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
240
Forks
113
PR merge metrics
No merged PRs in 30d

Description

I can see crashes in firebase caused by this, mostly on devices with android 8 and more (mostly Samsung devices).
App crashes during migration from shared preferences when trying to delete shared prefs.

Can somebody explain me why are you throwing IOException if deleteSharedPreferences() returns false on api >= 24, but you are silently continuing when prefs aren't able to delete on api < 24? Why can't you silently continue also for api >= 24?

Thank you for your answer.

![image](https://user-images.githubusercontent.com/26108416/128138717-90b095fa-b934-41a1-94fd-b348ac5815c6.png)

Contributor guide

Open the contributing guide

Research direction

Start by locating the migration code that calls deleteSharedPreferences() and compare its API >=24 and API <24 handling. Reproduce the failed deletion on an affected Android version, then verify the agreed behavior for deletion failure and cover it with the relevant test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.