android / codelab-android-datastore

Apache License 2.0
228 stars 105 forks source link

CRASH: Unable to delete SharedPreferences: prefs_name #36

Open jablkojem opened 3 years ago

jablkojem commented 3 years ago

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

rohitsat13 commented 3 years ago

Hi, can you please file a bug against the library here:

https://issuetracker.google.com/issues/new?component=907884&template=1466542

This does seem like an inconsistency that we may want to fix.

It'd be helpful if you can include how often you are seeing the crash. Also, it is probably worth catching and handling IOExceptions at call sites.

jablkojem commented 3 years ago

Sure, I will. I am not very satisfied with catching and handling this exception from the call site, because I don't know if I can consider this running migration as successful then..I guess that this 'cleanup' is some of the last steps of migration, but I think I am not the one who should decide this. image

jablkojem commented 3 years ago

https://issuetracker.google.com/issues/195553816

HedyHidouRy commented 2 years ago

We are actually facing the same issue, with most of samsung users as well, any other way to handle this or to have a patch soon ?

Thank you in advance

jablkojem commented 2 years ago

@HedyHidouRy I am not seeing this crash anymore, but it is because this is migration problem and almost all my users have already been migrated....but this is definitely not a solution, issue tracker is still without any response, I dont have any advice