-
Notifications
You must be signed in to change notification settings - Fork 7
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
App crashes after selecting a storage location on some Android 10 devices #43
Comments
634947e - I've edited the problematic locations to throw RuntimeExceptions that log the device's root tree URI. This will help us start diagnosing the issue by letting us see if there's a specific kind of URI / file system that's being affected. |
Upon further inspection in the Play Console, it seems this crash specifically affects Samsung devices running Android 10. As such, it probably has something to do with Samsung's file system. I've had the chance to speak to one such user and send them a modified APK that prints their file tree URI at the time of a crash. The URI was:
The prefix is significant because that means the device is serving a file URI, rather than a content URI as needed for API Level 24 and above. According to this StackOverflow answer, the issue may be resolved if we use |
Reopening this issue because another user contacted me yesterday saying that the fix didn't work for them. So there's still a subset of users affected by this crash. However, the first user I contacted said that the fix worked for them, so it will be included in 1.6.1 in the hopes that it will help at least some of the affected users. |
This issue is still occurring for some users, so I've conducted further investigation yielding the following insights:
Since this issue seems to mostly affect existing users after updating the app, it's more likely that the app directory cannot be read for some reason. But to make sure it's not a creation error, I've requested a few users to try uninstalling and reinstalling the app, then report back to me on whether the app directory was created or not. If you're an affected user reading this, then please do the same and let me know your results in this thread. Further investigation will occur once I've received responses on this matter. |
Thanks to the help of several diligent users, I was able to pinpoint the exact cause of this issue as well as develop a fix for it. The cause originates in the constructor for the Flipper utility class, StorageManagerCompat. For devices that have an Android SDK earlier than Q, this constructor automatically calls In most cases, In PermissionsActivity, we have code that overwrites this invalid root URI with the URI for the location that users grant permission to. This overwrite is accomplished by calling Adding onto this is the fact that in Flipper's Root class, the equality override only checks the 'name' attribute and not the 'uri' attribute. So although we're trying to do I confirmed this was happening by asking users to take screenshots of the file root URI at two different points in the setup process: when the URI is returned directly from ACTION_OPEN_DOCUMENT_TREE, transmitted to onActivityResult as the 'Intent data' parameter; and later, after the The fix, then, is to call Now, the remaining question is: why was this issue so inconsistent across Android 10 devices? I'm not able to confirm this 100%, but I suspect the affected devices still had With all of this now sorted out, this fix is slated to be released in 1.6.2 once we receive testing results from a few more users. If you are reading this and own an affected device, please consider helping us with testing by sending an email to averistudios@gmail.com asking for a test APK. |
Based on the investigation in #43, the external storage issue seems to occur when the file root URI is a "file:///" URI on an Android 10+ device. As such, the solution may be to convert these URIs to "content:///" URIs. For cases that don't match the criteria above (the URI is already a content URI, or Android version < 10), we don't do any conversion. This is to maintain stability for users unaffected by this issue.
Several users have said that the app crashes after they've selected the app's storage location on the Permissions page.
I've checked the Play Console logs and it would appear this is the culprit:
So this is an issue either with Flipper, how the Permissions page calls it, or the way we retrieve the root tree URI on Android 10+ devices. Given that the error is a
NullPointerException
, it seems the latter might be true and causing us to get a null tree URI. As such, it might be worth looking into tree URIs in more detail.The text was updated successfully, but these errors were encountered: