We have a strange problem with our Android app. In Fabric we have a very infrequent crash. It is a standard UnsatisfiedLinkError meaning that in the static initializer of the Java class, the .so library fails to load. This is what we have found out so far:
The problem is very rare. It happens in a couple of hundred devices out of hundreds of thousands or of installations.
Once it happens, it seems like restarting or even reinstallationdoes not solve it.
It happens across various brands like Sony, Samsung, Huawei.
It happens across all Android versions from 2.3 to 5.x.
We managed to catch it once in the office on a Nexus 1 device. When it started to happen, it always failed in the LoadLibrary call even though the same apk worked just fine on other devices.
When the problem happened, I removed the armv7a and x86 versions of the lib and only left the armeabi one to rule out the wrong lib was loaded, it still failed. Re-running the app through Android studio several times adding logs still caused the failure in the same place.
Then all of a sudden, without no obvious change, it started to work in the Nexus 1 and even after dozens of retries, we can not reproduce the problem again. The only thing that happened before it started to work was that I tried to manually install a corrupt apk with adb install which failed and the next time I loaded the app through Android studio, it worked and has worked even since. I am not sure if the failed installation of the corrupt apk somehow cleaned something out or if it was just a coincidence.
The thing I failed to do was to check that the armeabi .so file was actually present in the lib folder on the device when the failure occurred. I only came to think about this after it had already started to work.
So, to sum up. The apk is perfectly fine but and installs fine from Android studio the Play store on 99,9% of the devices but then under certain conditions (which are very rare), the LoadLibrary fails and when it does, there seems to be no obvious fix, not even reinstalling solved it but as I explained, something finally changed and when it started working on the Nexus 1, it has continued to work ever since.
This problem is really tricky since we have no way of reproduce it right now and we know it is affecting at least a small group of our users.
Any suggestions on how to narrow this down are welcome.