Can't get gallery access on old version of flutter for Android 13

186 Views Asked by At

The application has an image selection function. Before Android 13, everything works fine, but on version 13, no library gives access. This is most likely due to the fact that the project uses Flutter 1.22.0. with version Dart 2.10 (before null safety). I have already added to the manifest the necessary permissions:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="32" />

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

I tried the image_picker package, when calling the method, it raises the following error:

PlatformException(photo_access_denied, The user did not allow photo access., null, null)

So my question is, since switching to a later version of flutter is a rather time-consuming task, is it possible to somehow do without it? Maybe someone already had experience? I'm sure that the point is that the old versions of these libraries are not yet designed to work with Android 13

Thank you!

1

There are 1 best solutions below

2
sahil prajapati On

Your project developed in flutter version 1.22.0 which was released in 01 Oct 2020, and after then flutter was upgraded lots of time.

i face same issue in my one major flutter project. it was very complex and big project. we still work on it. so how we manage our 3 to 3.5 year old project?

its so much tough to upgrade my project with latest flutter version and plugIn. we now a day when we work on this project we every time downgrade flutter new version to my project applicable flutter version (in you case downgrade new flutter version to 1.22.0) and then we work, so no need to upgrade my plugIn/package version time to time.

if you face to problem downgrade flutter version by command like flutter downgrade (example: flutter downgrade v1.2.1) you can directly download Flutter SDK and install it as per flutter documentation.

Hope this will help you.