Repository: flutter
Issue: [Image_Picker] does not load images in release mode and throws PlatformException when ImageSource.camera
Labels: c: crash,platform-android,p: image_picker,package,a: release,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-android,triaged-android

I have a similar issue like #72759. 
It's only on release build and using the camera, gallery works. 

I've tried up and downgrading gradle. 
> flutter clean
> changing compiledSdkVersion
> flutter upgrade
> flutter pub upgrade

nothing helps. 


I've create a repo to reproduce. : https://github.com/jonaswre/image_picker_debug

1. Create project ```flutter create image_picker_debug --platforms=android```
2. Install image_picker: ```image_picker: ^0.8.5+3```
3. Update main.dart to open image_picker
4. Run app: ```flutter run --release --verbose```
5. Look at error: 
```
[+10383 ms] E/flutter (29377): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception:
PlatformException(error, null, null, java.lang.NullPointerException
[   +1 ms] E/flutter (29377):   at java.util.Objects.requireNonNull(Objects.java:220)
[        ] E/flutter (29377):   at java.util.Arrays$ArrayList.<init>(Arrays.java:3738)
[        ] E/flutter (29377):   at java.util.Arrays.asList(Arrays.java:3725)
[        ] E/flutter (29377):   at io.flutter.plugins.imagepicker.f.a(Unknown Source:16)
[        ] E/flutter (29377):   at io.flutter.plugins.imagepicker.f.b(Unknown Source:15)
[        ] E/flutter (29377):   at io.flutter.plugins.imagepicker.e$a.b(Unknown Source:2)
[        ] E/flutter (29377):   at io.flutter.plugins.imagepicker.e.E(Unknown Source:6)
[        ] E/flutter (29377):   at io.flutter.plugins.imagepicker.e.J(Unknown Source:10)
[        ] E/flutter (29377):   at io.flutter.plugins.imagepicker.ImagePickerPlugin.a(Unknown Source:229)
[        ] E/flutter (29377):   at w.i$a.a(Unknown Source:17)
[        ] E/flutter (29377):   at j.c.i(Unknown Source:18)
[        ] E/flutter (29377):   at j.c.j(Unknown Source:20)
[        ] E/flutter (29377):   at j.c.f(Unknown Source:0)
[        ] E/flutter (29377):   at j.b.run(Unknown Source:12)
[        ] E/flutter (29377):   at android.os.Handler.handleCallback(Handler.java:938)
[        ] E/flutter (29377):   at android.os.Handler.dispatchMessage(Handler.java:99)
[        ] E/flutter (29377):   at android.os.Looper.loopOnce(Looper.java:233)
[        ] E/flutter (29377):   at android.os.Looper.loop(Looper.java:344)
[        ] E/flutter (29377):   at android.app.ActivityThread.main(ActivityThread.java:8212)
[        ] E/flutter (29377):   at java.lang.reflect.Method.invoke(Native Method)
[        ] E/flutter (29377):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
[        ] E/flutter (29377):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
[        ] E/flutter (29377): )
[        ] E/flutter (29377): #0      StandardMethodCodec.decodeEnvelope
(package:flutter/src/services/message_codecs.dart:607)
[        ] E/flutter (29377): #1      MethodChannel._invokeMethod
(package:flutter/src/services/platform_channel.dart:167)
[        ] E/flutter (29377): <asynchronous suspension>
[        ] E/flutter (29377): #2      ImagePickerAndroid.getImage
(package:image_picker_android/image_picker_android.dart:161)
[        ] E/flutter (29377): <asynchronous suspension>
[        ] E/flutter (29377): #3      _MyHomePageState._incrementCounter (package:image_picker_debug/main.dart:57)
[        ] E/flutter (29377): <asynchronous suspension>
[        ] E/flutter (29377):


```

flutter doctor -v

```
[✓] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.856], locale en-DE)
    • Flutter version 3.0.5 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (5 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Users\JonasWrede\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.2.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.2.32616.157
    • Windows 10 SDK version 10.0.19041.0

[✓] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 11.0.12+7-b1504.28-7817840)

[✓] VS Code (version 1.69.2)
    • VS Code at C:\Users\JonasWrede\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

[✓] Connected device (5 available)
    • AC2003 (mobile)         • 06f28144      • android-arm64  • Android 12 (API 31)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows [Version 10.0.22000.856]
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 104.0.5112.81
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 103.0.1264.44

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

```

Thanks for the help