Skip to content

fixes find_library when deployed external storage #1291

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

Merged

Conversation

AndreMiras
Copy link
Member

Fixes find_library() OSError/FileNotFoundError exception when app
deployed external SD storage.
Apps deployed on external SD storage have different root prefix.
External SD storage apps root dir prefix is like:

/mnt/expand/<sd-card-id>/user/0/<package.domain>.<package.name>/files/app

While internal storage apps root dir prefix is:

/data/data/<package.domain>.<package.name>/files/app

Hence the [0:4] trick doesn't work.

Fixes `find_library()` `OSError`/`FileNotFoundError` exception when app
deployed external SD storage.
Apps deployed on external SD storage have different root prefix.
External SD storage apps root dir prefix is like:
```
/mnt/expand/<sd-card-id>/user/0/<package.domain>.<package.name>/files/app
```
While internal storage apps root dir prefix is:
```
/data/data/<package.domain>.<package.name>/files/app
```
Hence the `[0:4]` trick doesn't work.
AndreMiras added a commit to AndreMiras/EtherollApp that referenced this pull request Jun 3, 2018
AndreMiras added a commit to AndreMiras/EtherollApp that referenced this pull request Jun 3, 2018
@inclement
Copy link
Member

Looks good, did you test it on a device in the end? If not I'll try to do that before merging.

@AndreMiras
Copy link
Member Author

Yes I'm using that fix in one of my apps with monkey patching here:
AndreMiras/EtherollApp@604f5c6
So I do not actually use the fix from a p4a fork, but rather monkey patching with the same fix.

When the fix is not applied the app crashes when deployed on SD card. With the fix it's OK.
Basically on some device, download the APK from web browser and installing it, goes by default on SD card and then I received some Sentry reports. On some other devices it goes to the internal storage, but going to app info and changing it for external storage you can reproduce the crash.

@inclement inclement merged commit 8db9f34 into kivy:master Jun 11, 2018
@inclement
Copy link
Member

Great, thanks. I'm delighted that this probably fixes some of the mysterious crashes I've heard of but never been able to diagnose.

@AndreMiras
Copy link
Member Author

Great thanks for the merge. I hope so for the crashes. For records here are some stack trace from these crashes:
AndreMiras/EtherollApp#96

@AndreMiras AndreMiras deleted the feature/fix_file_not_found_on_external_sd branch October 6, 2018 17:40
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

Successfully merging this pull request may close these issues.

2 participants