Repository: flutter
Issue: ImagePicker Android release crash : FileUtils.java - Volume external_primary not found
Labels: c: crash,platform-android,p: image_picker,package,a: production,P2,needs repro info,team-android,triaged-android

### Steps to reproduce

Here is the crash log from my Crashlytics dashboard : 

<img width="493" alt="Capture d’écran 2024-11-07 à 17 53 33" src="https://github.com/user-attachments/assets/cb9f4e82-80db-4bba-a811-097b889da1d9">

```
 Fatal Exception: java.lang.IllegalArgumentException: Volume external_primary not found
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
       at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153)
       at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:781)
       at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2014)
       at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1813)
       at android.content.ContentResolver.openInputStream(ContentResolver.java:1490)
       at io.flutter.plugins.imagepicker.FileUtils.getPathFromUri(FileUtils.java:55)
       at io.flutter.plugins.imagepicker.ImagePickerDelegate.getPathsFromIntent(ImagePickerDelegate.java:673)
       at io.flutter.plugins.imagepicker.ImagePickerDelegate.handleChooseImageResult(ImagePickerDelegate.java:684)
       at io.flutter.plugins.imagepicker.ImagePickerDelegate.lambda$onActivityResult$0(ImagePickerDelegate.java:615)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)
```

Unfortunately i can't reproduce it, it happened on my Android live app and i have the error log in Crashlytics. 

I can provide the Android configuration where the crash occured : 

<img width="1048" alt="Capture d’écran 2024-11-07 à 17 52 09" src="https://github.com/user-attachments/assets/01b02d0e-c35e-498c-97d9-2c9d5904edc2">

### Expected results

The app should not crash.

### Actual results

The app is crashing.

### Code sample

<details open><summary>Code sample</summary>

```dart
[Paste your code here]
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
  Fatal Exception: java.lang.IllegalArgumentException: Volume external_primary not found
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
       at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153)
       at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:781)
       at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:2014)
       at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1813)
       at android.content.ContentResolver.openInputStream(ContentResolver.java:1490)
       at io.flutter.plugins.imagepicker.FileUtils.getPathFromUri(FileUtils.java:55)
       at io.flutter.plugins.imagepicker.ImagePickerDelegate.getPathsFromIntent(ImagePickerDelegate.java:673)
       at io.flutter.plugins.imagepicker.ImagePickerDelegate.handleChooseImageResult(ImagePickerDelegate.java:684)
       at io.flutter.plugins.imagepicker.ImagePickerDelegate.lambda$onActivityResult$0(ImagePickerDelegate.java:615)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.4, on macOS 15.1 24B83 darwin-x64, locale
    fr-FR)
    • Flutter version 3.24.4 on channel stable at
      /Users/foxtom/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (2 weeks ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/foxtom/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915915-b509.11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • 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 21.0.3+-79915915-b509.11)

[✓] VS Code (version 1.95.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • Now You See Me (mobile) • 00008020-001204401E78002E • ios            • iOS
      18.1 22B83
    • macOS (desktop)         • macos                     • darwin-x64     •
      macOS 15.1 24B83 darwin-x64
    • Chrome (web)            • chrome                    • web-javascript •
      Google Chrome 130.0.6723.117

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>