I'm working on a Flutter project with version 1.22.6, and due to dependency constraints, upgrading to a later Flutter version is not an option. The project relies on image_picker version ^0.6.7+22 for capturing images from the camera. I can select images from camera. However, I'm currently facing challenges when attempting to access photos from the gallery.

When trying to select images from the gallery, I encounter the following PlatformException error:

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

Manifest Permissions:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.GALLERY"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:name="android.hardware.location.network" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false"  />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

build.gradle

android {
    compileSdkVersion 29
 
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.example.label"
        minSdkVersion 16
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }
}

I have performed 'flutter clean' and verified that the required permissions were indeed granted using the permission_handler package, which returned as granted. I have also verified the app permissions are granted inside settings.

0

There are 0 answers