natysoz / expo-images-picker

Multiple Asset Photos Videos selecting package for Expo SDK
MIT License
95 stars 36 forks source link

Android already accepted permissions but still not showing photos #58

Open Rafaell416 opened 2 years ago

Rafaell416 commented 2 years ago

Expo SDK 45 expo-images-picker@2.4.1

natysoz commented 2 years ago

can you share your package json?

Rafaell416 commented 2 years ago
{
  "name": "level",
  "version": "1.1.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@apollo/client": "^3.6.5",
    "@expo-google-fonts/mulish": "^0.2.2",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/native-stack": "^6.6.2",
    "@reduxjs/toolkit": "^1.8.2",
    "@sentry/react-native": "^3.4.2",
    "apollo-upload-client": "^17.0.0",
    "dayjs": "^1.11.2",
    "expo": "^45.0.0",
    "expo-application": "~4.1.0",
    "expo-clipboard": "~3.0.1",
    "expo-constants": "~13.1.1",
    "expo-device": "~4.2.0",
    "expo-font": "~10.1.0",
    "expo-image-manipulator": "~10.3.1",
    "expo-images-picker": "^2.4.1",
    "expo-media-library": "~14.1.0",
    "expo-secure-store": "~11.2.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.1",
    "expo-web-browser": "~10.2.0",
    "graphql": "^16.5.0",
    "install": "^0.13.0",
    "prop-types": "^15.8.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-google-places-autocomplete": "^2.4.1",
    "react-native-mime-types": "^2.3.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-skeleton-content": "^1.0.24",
    "react-native-swiper": "^1.6.0",
    "react-native-web": "0.17.7",
    "react-redux": "^7.2.8",
    "redux": "^4.2.0",
    "redux-persist": "^6.0.0",
    "sentry-expo": "^4.2.0",
    "styled-components": "^5.3.5",
    "uuid": "^3.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

The app prompts the permissions request, After accepting this is what I see

Screen Shot 2022-05-27 at 1 26 39 PM

This is only happening with the standalone build, when I run the app on expo go it works well.

Rafaell416 commented 2 years ago

Hi @natysoz I solved the Permissions issue by adding the following code to the plugins section in the app.json file

[
    "expo-media-library",
    {
      "photosPermission": "Allow...",
      "isAccessMediaLocationEnabled": true
    }
]

But now I'm running into another Issue, the app crashes when the AssetsSelector is rendered, Android, Standalone build

natysoz commented 2 years ago

without edit the app.json

after u enter the settings , allow permissions and go back , it is still showing you this same error ? if so did you try close and re open the app and see what happens ?

Rafaell416 commented 2 years ago

without edit the app.json

after u enter the settings , allow permissions and go back , it is still showing you this same error ? if so did you try close and re open the app and see what happens ?

Yeah, I closed the app, open again and so on. The error was still happening.

Rafaell416 commented 2 years ago

Talking about the crash, I noticed that it only happens on android version 9

natysoz commented 2 years ago

did u try newer android version ?

natysoz commented 2 years ago

i think that expo media lib is not working for android 9

KhalilHakim commented 2 years ago

Any update on the root cause?

natysoz commented 2 years ago

can u share expo snack that show the issue ?

imagina commented 2 years ago

Same error here. @natysoz It's only happening after compilation. The expo snack works fine.

majirosstefan commented 2 years ago

Android 11, Android 12 are experiencing this bug too in ejected "expo": "~44.0.0".. Without fix it's unusable on Android in ejected Expo app

EDIT: I was able to fix that by adding following permission into Android manifest & rebuild the app:

<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />

Here is a source link: https://github.com/expo/expo/issues/15273

JcbPrn commented 2 years ago

Is the permissions bug solved on SDK 46?

natysoz commented 2 years ago

ill update the package tommrow

tej17584 commented 2 years ago

Hi @Rafaell416 I had the same issue: The images were not showing in Android. What I did was to update my Expo SDK, but that crashed the entire project. So, I was aware the new EXPO SDK had the fix for the images don't showing: I just needed to know in WICH library. So, I updated and checked wich libraries changed. After that, I update one library at the time and see wich one had the fix. Let me save you hours of debugging. The library you need to update is only this one to this version:

"expo-media-library": "~14.1.0"

I'll attach my package.json

"dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-regular-svg-icons": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@fortawesome/react-native-fontawesome": "^0.2.7",
    "@react-native-async-storage/async-storage": "^1.16.1",
    "@react-native-community/hooks": "^2.8.1",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/picker": "^1.8.1",
    "@react-native-picker/picker": "^2.4.1",
    "@react-navigation/core": "^6.1.1",
    "@react-navigation/drawer": "^6.3.1",
    "@react-navigation/material-bottom-tabs": "^6.1.1",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/native-stack": "^6.5.0",
    "@react-navigation/stack": "^6.1.1",
    "@sentry/react-native": "^4.2.2",
    "expo": "^44.0.6",
    "expo-app-loading": "~1.3.0",
    "expo-application": "~4.0.1",
    "expo-clipboard": "~2.1.0",
    "expo-constants": "~13.0.1",
    "expo-device": "~4.1.0",
    "expo-file-system": "~13.1.4",
    "expo-image-manipulator": "~10.2.0",
    "expo-image-picker": "~12.0.1",
    "expo-images-picker": "^2.3.0",
    "expo-linking": "~3.0.0",
    "expo-location": "~14.0.1",
    "expo-media-library": "~14.1.0",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "expo-updates": "~0.11.7",
    "firebase": "8.2.3",
    "formik": "^2.2.9",
    "lottie-react-native": "^5.0.1",
    "moment": "^2.29.3",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-bouncy-checkbox": "^2.1.10",
    "react-native-currency-input": "^1.0.1",
    "react-native-gesture-handler": "~2.1.0",
    "react-native-image-viewing": "^0.2.2",
    "react-native-paper": "^4.11.2",
    "react-native-reanimated": "~2.1.0",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.10.1",
    "react-native-select-dropdown": "^1.13.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^9.1.0",
    "react-native-web": "0.17.1",
    "react-number-format": "^4.9.1",
    "sentry-expo": "^4.0.0",
    "twrnc": "^3.2.0",
    "yup": "^0.32.11"
  },

and my app.json configuration for plugins:

"plugins": [
      [
        "expo-image-picker",
        {
          "photosPermission": "The app needs your permission"
        }
      ],
      [
        "expo-media-library",
        {
          "photosPermission": "Allow XXX to access your photos.",
          "savePhotosPermission": "Allow XXX to save photos.",
          "isAccessMediaLocationEnabled": "true"
        }
      ],
      [
        "sentry-expo"
      ]
    ],

Hope it works!!!