Repository navigation
[image_picker] No longer able to select photos from Google Photos #121744
Copy link
Copy link
Closed
flutter/packages
#3370Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listp: image_pickerThe Image Picker plugin.The Image Picker plugin.packageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
My Android device has updated to use the new Photo Picker (https://developer.android.com/training/data-storage/shared/photopicker)
I used to be able to view and select images from my google photos app or anywhere else, but now I'm only able to select an image that have been taken with this phone.
Expected results:
I expect to be able to still select an image from somewhere else on my device.
Actual results:
I can only select a photo from Photos or Albums. Albums only has Camera, Screenshots, and Downloads.
Code sample
final imagePicker = ImagePicker();
final XFile? pickedFile = await imagePicker.pickImage(
source: ImageSource.gallery,
requestFullMetadata: false,
);Logs
[!] Flutter (Channel stable, 3.7.3, on macOS 13.2 22D49 darwin-arm64, locale en-US)
• Flutter version 3.7.3 on channel stable at /Users/daniel/fvm/versions/3.7.3
! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/daniel/fvm/versions/3.7.3. Consider adding /Users/daniel/fvm/versions/3.7.3/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9944297138 (3 weeks ago), 2023-02-08 15:46:04 -0800
• Engine revision 248290d6d5
• Dart version 2.19.2
• DevTools version 2.20.1
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1)
• Android SDK at /Users/daniel/Library/Android/sdk
• Platform android-33, build-tools 32.0.0-rc1
• Java binary at: /Users/daniel/.sdkman/candidates/java/current/bin/java
• Java version OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2022.1)
• Android Studio at /Users/daniel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9619390/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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
• IntelliJ at /Users/daniel/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin version 71.3.6
• Dart plugin version 223.8617.8
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
• IntelliJ at /Users/daniel/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/223.8617.56/IntelliJ IDEA.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
[✓] VS Code (version 1.75.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (3 available)
• Pixel 7 Pro (mobile) • 2A211FDH300687 • android-arm64 • Android 13 (API 33)
• iPhone (mobile) • 00008020-001069A00A43002E • ios • iOS 16.3.1 20D67
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5481.177
[✓] HTTP Host Availability
• All required HTTP hosts are available
| Before | After |
|---|---|
![]() |
![]() |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listp: image_pickerThe Image Picker plugin.The Image Picker plugin.packageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version


Activity
danagbemava-nc commentedon Mar 2, 2023
Hi @DanMossa, I believe this is a limitation of the new Photo Picker on android 13 and not an issue with the plugin. I can't seem to find any API from the new picker that would allow that. Are you aware of any such API?
DanMossa commentedon Mar 2, 2023
I appreciate the quick response! @danagbemava-nc
Unfortunately I'm not familiar with the Android APIs. But I've been looking around and I'm wondering if any of these links help?
https://developers.google.com/drive/picker/reference
https://issuetracker.google.com/issues/264952941
EDIT: I've noticed that when using an older image_picker, the issue doesn't happen.
Works when my pubspec.lock shows
I was able to confirm that this issue happens once my pubspec.lock shows
This indicates that the issue comes from image_picker. Or at the least, this package shouldn't change that functionality until the Photo Picker is more mature.
lukehutch commentedon Mar 3, 2023
I have the same issue. The app I'm developing used to present a view (via
image_picker) that allowed me to choose images from either Drive or Google Photos, for the logged-in Google account. However, I made a bunch of changes to dependencies, and now suddenly when I rebuilt the app, the photo picker view only shows the following options:I have no idea which change disabled the ability of
image_pickerto pick photos in Drive or Google Photos, but this is a major step back from the old functionality.lukehutch commentedon Mar 3, 2023
In my case, downgrading the dependency version from
0.8.6+3to0.8.6+1did not solve the problem (and in fact I checked, and the version was0.8.6+3both before and after the file picker broke).At this point I have no idea how to restore the old behavior. Something changed in the project, and I have no idea what.
DanMossa commentedon Mar 3, 2023
Downgrading the dependency didn't actually help me either. I had to go into my pubspec.lock and revert the changes there. :/
lukehutch commentedon Mar 3, 2023
@DanMossa Thanks, that worked for me too. (Now I finally understand what
pubspec.lockdoes :-D )So this is indeed breakage in some recent version of
image_picker.lukehutch commentedon Mar 3, 2023
The UI when things are working, for comparison:
danagbemava-nc commentedon Mar 3, 2023
Hi @lukehutch, technically, this is not a breakage. The plugin was recently updated to use the more privacy-focused photo picker of android 13 to fulfill the request in #104250. So you could say this is the correct behavior of the photo picker.
This is the PR in question flutter/packages#3267.
@DanMossa, since this is the intended behavior of the new photo picker API and will likely be the behavior going forward(according to https://issuetracker.google.com/issues/264952941#comment4), would it help if we documented that on newer versions of android users may not be able to access external image providers?
DanMossa commentedon Mar 3, 2023
Yeah! I think it would be helpful to put in the changelog or something that this changes functionally until the photopicker implements an API to select external image providers.
In an ideal world this would be a major version change.
tarrinneal commentedon Mar 3, 2023
Thanks for raising this issue.
We're going to add a config option to decide which version of the picker you would like to use while we wait for the cloud features to be added to the new image picker.
This will default to the old version, so you shouldn't need to change anything to get this feature back.
lukehutch commentedon Mar 3, 2023
How exactly does the new dialog improve privacy, especially if it is going to add back in the cloud features?
+1 on making this configurable.
stuartmorgan-g commentedon Mar 3, 2023
This is because the change is in
image_picker_android(specifically0.8.5+7of that package), notimage_picker. That's what you'd need to temporarily pin if you want to avoid the change for now.github-actions commentedon Mar 23, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.