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

Unable to pick files with custom or any file type on Android 14 #1404

Closed
1 of 4 tasks
VladStarikovEk opened this issue Nov 8, 2023 · 71 comments
Closed
1 of 4 tasks
Assignees
Labels
android Issue applies to Android platform high priority High priority issue needs investigation stale triage Further information is requested

Comments

@VladStarikovEk
Copy link

VladStarikovEk commented Nov 8, 2023

Describe the bug
When picking files with custom or any file type on Android 14, when one or multiple files are picked it just closes assuming that the user closed it. I also got I/FilePickerDelegate(21624): User cancelled the picker request message in logs.

When picking image, audio, video or media everything works fine, but the picker has a gallery UI, rather then file explorer UI. I also checked this on Android 13 emulator - it works file there.

Platform

  • Android
  • iOS
  • Web
  • Desktop

Platform OS version
Pixel 5 - Android 14

How are you picking?

final pickerResult = await _filePicker.pickFiles(
      type: FileType.custom,
      allowMultiple: true,
      allowedExtensions: ['jpg', 'jpeg', 'png', 'pdf'],
 );

or

final pickerResult = await _filePicker.pickFiles(
      type: FileType.any,
);

Details to reproduce the issue

Error Log

D/FilePickerDelegate(21624): Selected type */*
I/FilePickerDelegate(21624): User cancelled the picker request

Screenshots and/or video

https://github.com/miguelpruivo/flutter_file_picker/assets/99865323/ade3be44-b8f9-48b8-a509-d7aff62de0ad
Screenshot 2023-11-08 at 15 35 34

Flutter Version details

❯ flutter doctor -v
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-arm64, locale en-UA)
    • Flutter version 3.13.9 on channel stable at /Users/vstarikov/fvm/versions/3.13.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (2 weeks ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/vstarikov/Library/Android/sdk
    • Platform android-34, build-tools 33.0.0
    • ANDROID_HOME = /Users/vstarikov/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Community Edition (version 2022.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (3 available)
    • Pixel 5 (mobile) • 0B241FDD4001ZT • android-arm64  • Android 14 (API 34)
    • macOS (desktop)  • macos          • darwin-arm64   • macOS 14.1 23B74 darwin-arm64
    • Chrome (web)     • chrome         • web-javascript • Google Chrome 119.0.6045.123

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Additional context
Requested permissions in AndroidManifest

   <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.USE_BIOMETRIC" />
@VladStarikovEk VladStarikovEk added the new issue An issue that hasn't yet been seen from the maintainer label Nov 8, 2023
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Nov 16, 2023
@DominicOrga
Copy link

I am also experiencing this issue, but in my case it occurs on my Pixel 4A Android 13.
What's weird is that the file picker does not work on my main (large) project, but works fine on a newly created test project.

How are you picking?

FilePicker.platform.pickFiles(
  allowMultiple: true,
  allowedExtensions: ['pdf'],
  type: FileType.custom,
);

Output (Main Project):

D/FilePickerUtils(26411): Allowed file extensions mimes: [application/pdf]
D/FilePickerDelegate(26411): Selected type */*
I/FilePickerDelegate(26411): User cancelled the picker request

Output (Test Project):

D/FilePickerUtils(28311): Allowed file extensions mimes: [application/pdf]
D/FilePickerDelegate(28311): Selected type */*
I/FilePickerUtils(28311): Caching from URI: content://com.android.providers.media.documents/document/document%3A83
D/FilePickerUtils(28311): File loaded and cached at:/data/user/0/com.example.file_picker_test/cache/file_picker/dummy.pdf
D/FilePickerDelegate(28311): File path:[com.mr.flutter.plugin.filepicker.FileInfo@144d1d0]

@github-actions github-actions bot removed the stale label Nov 21, 2023
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Nov 29, 2023
@TheCarpetMerchant
Copy link

@VladStarikovEk Did you manage to solve this ? If so, how ?

@github-actions github-actions bot removed the stale label Dec 3, 2023
@fesaworld
Copy link

i got the same problem, and i found a way to solve it..

you can try changing android:launchMode="singleInstance" in /main/AndroidManifest.xml to android:launchMode="singleTop"

image

@VladStarikovEk
Copy link
Author

@TheCarpetMerchant Sadly - no. We still experiencing it.

@TheCarpetMerchant
Copy link

@VladStarikovEk there's a pull request opened for the fix. Just got it into prod and users confirm it works.
The pull request is 35 commits behind, so I made my own fork for it.

@VladStarikovEk
Copy link
Author

@VladStarikovEk there's a pull request opened for the fix. Just got it into prod and users confirm it works. The pull request is 35 commits behind, so I made my own fork for it.

Will try it. Thanks!

Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Dec 13, 2023
@VladStarikovEk
Copy link
Author

I'm glad to report that the fix from this PR works.
For now I'm using this way to add file_picker dependency:

  file_picker:
    git:
      url: https://github.com/melWiss/flutter_file_picker.git

@github-actions github-actions bot removed the stale label Dec 14, 2023
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Dec 22, 2023
@zambetpentru
Copy link

I'm glad to report that the fix from this PR works. For now I'm using this way to add file_picker dependency:

  file_picker:
    git:
      url: https://github.com/melWiss/flutter_file_picker.git

I confirm it's also working on my Samsung Galaxy when upgraded to Android 14

@github-actions github-actions bot removed the stale label Dec 31, 2023
Copy link

github-actions bot commented Jan 7, 2024

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Jan 7, 2024
@TheCarpetMerchant
Copy link

Up

@github-actions github-actions bot removed the stale label Jan 8, 2024
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Jan 15, 2024
@kiokumicu
Copy link

Up

@arthurgiani
Copy link

up

Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Jun 12, 2024
@renancacao
Copy link

ok, bad bot

@github-actions github-actions bot removed the stale label Jun 19, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Jun 27, 2024
@zambetpentru
Copy link

Bad bot

@github-actions github-actions bot removed the stale label Jul 6, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Jul 13, 2024
@zambetpentru
Copy link

Bad bot

@github-actions github-actions bot removed the stale label Jul 15, 2024
@stan-at-work
Copy link

stan-at-work commented Jul 15, 2024

Add the stale tag please...

@rohinton-collins
Copy link

rohinton-collins commented Jul 15, 2024

I fixed this by

-    FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.image, compressionQuality: 0);
+    FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.custom, allowedExtensions: ['png', 'jpg', 'jpeg'], compressionQuality: 0);

Setting compressionQuality to zero fixes a different bug for Android 9/10. But changing the type to custom and setting the allowedExtensions brought up a different dialog which seemed to work.

I already had

android:launchMode="singleTop"

This also works:

    FilePickerResult? result = await FilePicker.platform.pickFiles(compressionQuality: 0);

So problem appears to be 'type: FileType.image'

Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Jul 23, 2024
@sneurlax
Copy link

sneurlax commented Jul 23, 2024 via email

@github-actions github-actions bot removed the stale label Jul 24, 2024
Copy link

github-actions bot commented Aug 5, 2024

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Aug 5, 2024
@stan-at-work
Copy link

Could someone close and reopen this. The notifications are annoying me.

@github-actions github-actions bot removed the stale label Aug 7, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Aug 14, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@Mandar-100
Copy link

I am still facing these issue can anyone give me a solution for these???.
Thanks inn advance.

@rohintonc
Copy link

@stephane-archer
Copy link
Contributor

#1628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issue applies to Android platform high priority High priority issue needs investigation stale triage Further information is requested
Projects
None yet
Development

No branches or pull requests