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

Android 11: "Sorry, no external application has been found to complete this action" when trying to open a PDF #3067

Closed
ThiefMaster opened this issue Mar 27, 2021 · 3 comments · Fixed by #3238
Assignees

Comments

@ThiefMaster
Copy link

Describe the bug

When tapping a PDF file someone sent me (or I sent), it doesn't open, but error_no_external_application_found ("Sorry, no external application has been found to complete this action.") shows up instead. The only workaround right now is to long-press the file, save locally, and then open it from the file download notification or a file manager.

To Reproduce

Steps to reproduce the behavior:

  1. Receive a PDF (maybe sending one yourself works as well, I tested it with one I sent via the desktop app)
  2. Click on the file
  3. See error

Expected behavior

The PDF file opening in any PDF viewer on the phone

Smartphone (please complete the following information):

  • Device: Pixel 5 (happens on Pixel 3a XL as well)
  • OS: Android 11

Additional context

  • App version and store: 1.1.3 via Play store
  • Homeserver: private (ran by me, so if it might be homeserver-related (which I doubt) let me know)
@warwicklol14
Copy link

warwicklol14 commented Apr 15, 2021

I had the same bug too on my Samsung M31 device running Android 11. It was not just for pdf but also for pptx, docx files.
I tried to find what was causing the bug by debugging it.

It turns out that https://github.com/vector-im/element-android/blob/9565e8975e31f8b873369e22e29d51824f8b20ca/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt#L598 always returns null regardless of the file in Android 11.

I searched some more and found that package visibility changed in Android 11 https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9
It says here in https://developer.android.com/training/package-visibility/use-cases#kotlin that it's better to handle the ActivityNotFoundException.

So I tested it and it works fine after this change https://github.com/warwicklol14/element-android/commit/a6e2947115c698e56b796be04e7f8631c3f49de0.

Tested on:
Android 11 - Android Emulator (Pixel 3a) , Real device (Samsung M31)
Android 10 - Android Emulator (Pixel 2)
Android API 21 - Android Emulator (Pixel 2) (As requested in CONTRIBUTING.md)

All lints and quality checks pass.

I would like to make a pull request if the code is okay with the element android team.

@bmarty
Copy link
Member

bmarty commented Apr 20, 2021

Hello @warwicklol14 , yes a PR will be appreciated to fix this issue on Android 11, thanks!

@bmarty bmarty changed the title "Sorry, no external application has been found to complete this action" when trying to open a PDF Android 11: "Sorry, no external application has been found to complete this action" when trying to open a PDF Apr 20, 2021
@bmarty bmarty self-assigned this Apr 28, 2021
bmarty added a commit that referenced this issue Apr 28, 2021
Add <queries> tag in manifest to be able to open file using external app and to use full feature of CustomTab
@bmarty
Copy link
Member

bmarty commented Apr 28, 2021

Fixed in Element 1.1.7

yostyle referenced this issue in tchapgouv/tchap-android Apr 29, 2021
Changes in Element 1.1.7 (2021-XX-XX)
===================================================

Features ✨:
 - Spaces beta

Improvements 🙌:
 - Add ability to install APK from directly from Element (#2381)

Bugfix 🐛:
 - Message states cosmetic changes (#3007)
 - Fix exception in rxSingle (#3180)
 - Do not invite the current user when creating a room (#3123)
 - Fix color issues when the system theme is changed (#2738)
 - Fix issues on Android 11 (#3067)
 - Fix issue when opening encrypted files (#3186)

Translations 🗣:
 -

SDK API changes ⚠️:
 - RegistrationWizard.createAccount() parameters are now all optional, following Matrix spec (#3205)

Build 🧱:
 - Upgrade to gradle 7

Test:
 -

Other changes:
 - New store descriptions

Changes in Element 1.1.6 (2021-04-16)
===================================================

Bugfix 🐛:
 - Fix crash on the timeline
 - App crashes on "troubleshoot notifications" button (#3187)

Changes in Element 1.1.5 (2021-04-15)
===================================================

Bugfix 🐛:
 - Fix crash during Realm migration
 - Fix crash when playing video (#3179)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants