Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError on some devices in non-primitive Adapter. #77

Closed
NightlyNexus opened this issue Mar 20, 2017 · 3 comments
Closed

AssertionError on some devices in non-primitive Adapter. #77

NightlyNexus opened this issue Mar 20, 2017 · 3 comments

Comments

@NightlyNexus
Copy link
Contributor

I've got about 20 distinct-device reports from Crashlytics that show an AssertionError in my StringAdapter.
The only way that could happen is if the device has a broken implementation of SharedPreferences.contains() or Editor.delete().

Crashlytics shows about a third of the devices as rooted (honestly not sure if Crashlytics just does a Runtime.getRuntime().exec("su") or what), so I'm guessing 100% of them are using broken firmware.

I'm closing these crash reports with prejudice, but has anybody observed this behavior?
I'm just hoping there isn't some Samsung phone that legitimately shipped with broken firmware that merits a workaround.

@f2prateek
Copy link
Owner

Could it also be a race - if you delete a preference between the contains check in RealPreference and get call in the adapter?

@NightlyNexus
Copy link
Contributor Author

Good thought!
In this case, I'm only using the Preference on one thread, though, so these errors are something else, sadly.

But, still, should RealPreference lock there?

@NightlyNexus
Copy link
Contributor Author

NightlyNexus commented Mar 23, 2017

I found my original problem.
I was reusing a key from before I was using rx-preferences.
There was code doing Editor.putString(key, null), and old versions of Android did not delete the preference then. Fixed here: https://android-review.googlesource.com/74070

So, contains() was true, and getString() was null for those broken devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants