I am seeing excessive crash rates on Google Play > 3.5%, but more than 99% of them are result of one crash that affects only one user. This is the crash:
java.lang.IllegalStateException:
at android.app.SharedPreferencesImpl.awaitLoadedLocked (SharedPreferencesImpl.java:265)
at android.app.SharedPreferencesImpl.edit (SharedPreferencesImpl.java:349)
at crc646a240b12c1f538a7.BBarActivity.n_onCreate (Native Method)
at crc646a240b12c1f538a7.BBarActivity.onCreate (Unknown Source)
at android.app.Activity.performCreate (Activity.java:7169)
at android.app.Activity.performCreate (Activity.java:7160)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3001)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3156)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1864)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:205)
at android.app.ActivityThread.main (ActivityThread.java:6996)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:884)
Caused by: java.lang.OutOfMemoryError:
at java.util.Arrays.copyOf (Arrays.java:3260)
at java.lang.AbstractStringBuilder.ensureCapacityInternal (AbstractStringBuilder.java:125)
at java.lang.AbstractStringBuilder.append (AbstractStringBuilder.java:605)
at java.lang.StringBuilder.append (StringBuilder.java:191)
at org.kxml2.io.KXmlParser.readValue (KXmlParser.java:1454)
at org.kxml2.io.KXmlParser.next (KXmlParser.java:401)
at org.kxml2.io.KXmlParser.next (KXmlParser.java:321)
at com.android.internal.util.XmlUtils.readThisValueXml (XmlUtils.java:1427)
at com.android.internal.util.XmlUtils.readThisMapXml (XmlUtils.java:830)
at com.android.internal.util.XmlUtils.readThisValueXml (XmlUtils.java:1481)
at com.android.internal.util.XmlUtils.readValueXml (XmlUtils.java:1397)
at com.android.internal.util.XmlUtils.readMapXml (XmlUtils.java:740)
at android.app.SharedPreferencesImpl.loadFromDisk (SharedPreferencesImpl.java:153)
at android.app.SharedPreferencesImpl.access$000 (SharedPreferencesImpl.java:54)
at android.app.SharedPreferencesImpl$1.run (SharedPreferencesImpl.java:122)
Reading the above this seems to happen due to low memory. As this happens only to this user it is hard to say what exactly may be the problem, it could be theoretically that some stored preference went wild and got some incredibly long value, though this is just a theoretical point I don't see how it could happen in the code. It surely helps that his phone is LGE LG K40 which has just 2 GB of RAM. Finally this is happening on the main screen so it could be that it is happening at the launch and that somehow his device doesn't free enough memory for the first launch so he has to launch app multiple times until that happens. And this is a very frequent user and it seems that he gave 5 stars to the app.
The problem is that this statistics likely influences the ranking of the app and as such current state is not acceptable. But I am not sure what can be done.
I've tried to do some try catch when accessing preferences to eventually workaround the crash, but it doesn't seem to help.
The only thing that comes to my mind is to exclude this particular model of device on Google Play. I think that in that case the user won't be able to receive updates anymore. While Google Play will still report excessive crash rates at least those won't happen on the latest version and it is reasonable to expect that Google doesn't count crash in older versions of the app when ranking the app.
Did anyone had similar situation? Is there some coding solution to it? Or any kind of workaround that would stop this excessive crash rate report on Google Play?