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 · 78 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

@github-actions github-actions bot added stale and removed stale labels Jul 23, 2024
@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
@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

@Henry-Hiles
Copy link

@melWiss would it be possible for you to rebase your branch to have the latest changes with your fixes? Thanks!

@Henry-Hiles
Copy link

Henry-Hiles commented Jan 7, 2025

Turns out to be an easy, one line fix, so I made my own fork: https://github.com/henry-hiles/flutter_file_picker

Repository owner deleted a comment from github-actions bot Jan 8, 2025
Repository owner deleted a comment from github-actions bot Jan 8, 2025
Repository owner deleted a comment from sneurlax Jan 8, 2025
Repository owner deleted a comment from github-actions bot Jan 8, 2025
@melWiss
Copy link

melWiss commented Jan 8, 2025

hey, sorry I just saw the notification and totally forgot about this issue (in our codebase we used our fork directly), is your fork merged to main? @Henry-Hiles

@melWiss would it be possible for you to rebase your branch to have the latest changes with your fixes? Thanks!

@Henry-Hiles
Copy link

hey, sorry I just saw the notification and totally forgot about this issue (in our codebase we used our fork directly), is your fork merged to main? @Henry-Hiles

@melWiss would it be possible for you to rebase your branch to have the latest changes with your fixes? Thanks!

No, similar PRs were made in the past and not accepted, so I'm just using my fork. I was using yours before, but I needed a more up-to-date fork. Thanks!

@TheCarpetMerchant
Copy link

TheCarpetMerchant commented Jan 21, 2025

@miguelpruivo I also, to this day since 2 years ago, have been using my own fork in order to work around this problem.
It is extremely easy to reproduce (use the pickFile function on Android 14 to select a non-standard document, like .xyz) and I've had literally hundreds of thousands of users not report an issue. Is there any reason this hasn't been solved ?

@Henry-Hiles
Copy link

@miguelpruivo I also, to this day since 2 years ago, have been using my own fork in order to work around this problem. It is extremely easy to reproduce (use the pickFile function on Android 14 to select a non-standard document, like .xyz) and I've had literally hundreds of thousands of users not report an issue. Is there any reason this hasn't been solved ?

I think it breaks compatability with older android versions.

@lumpidu
Copy link

lumpidu commented Jan 23, 2025

it's broken anyways

@doudar
Copy link

doudar commented Jan 25, 2025

Broken here as well. Trying to pick a .zwo file. It works on older android devices, but not newer devices.

@Henry-Hiles
Copy link

Broken here as well. Trying to pick a .zwo file. It works on older android devices, but not newer devices.

You can use my fork: https://github.com/henry-hiles/flutter_file_picker

I think it may break compatability with older android versions though.

@lumpidu
Copy link

lumpidu commented Jan 26, 2025

@Henry-Hiles : proposal: could you add Android version check and use the former behaviour for older platforms ? According to https://developer.android.com/training/data-storage/shared/documents-files the new behaviour is supported for API level 19 and above:

if(Build.VERSION.SDK_INT >= 19) {
    intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
} else {
   intent = new Intent(Intent.ACTION_GET_CONTENT);
}

See also https://developer.android.com/reference/android/os/Build.VERSION#SDK_INT

I think, this would also qualify as pull request for this repository.

@joma1021
Copy link

joma1021 commented Feb 7, 2025

any news on this issue?

MrCsabaToth referenced this issue in TrackMyIndoorWorkout/TrackMyIndoorWorkout Feb 9, 2025
…, package_info_plus, syncfusion_flutter_charts

Transitive upgrade audioplayers_android, audioplayers_linux, device_info_plus_platform_interface, syncfusion_flutter_core
@pkd234
Copy link

pkd234 commented Feb 14, 2025

Its working on older version for me tried 6.2.1.

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