0

I am using react-native-image-picker of version 0.28.1 as per their document I think I am using right version of image-picker as per my react-native version. Also added permissions in AndroidManifest.xml but getting me error "ImagePicker Error: Permissions weren't granted"

Not getting solution on it. kindly help. Thanks In Advance.

package.json

  "dependencies": {
  "jetifier": "^1.6.3",
  "react": "16.8.3",
  "react-moment": "^0.9.2",
  "react-native": "0.59.9",
  "react-native-gesture-handler": "^1.3.0",
  "react-native-image-picker": "^0.28.1",
  "react-navigation": "^3.11.0"
},
"devDependencies": {
  "@babel/core": "^7.4.5",
  "@babel/runtime": "^7.4.5",
  "babel-jest": "^24.8.0",
  "jest": "^24.8.0",
  "metro-react-native-babel-preset": "^0.54.1",
  "react-test-renderer": "16.8.3"
},

android/build.gradle

    ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
}

node_modules\react-native-image-picker\android

def DEFAULT_COMPILE_SDK_VERSION = 27
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
def DEFAULT_TARGET_SDK_VERSION = 26

AndroidManifest.xml

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
Mayuresh Patil
  • 2,072
  • 1
  • 21
  • 44
  • Did you also follow all their steps in the actual install docs instead of the readme? https://github.com/react-native-community/react-native-image-picker/blob/master/docs/Install.md – Rik Jul 15 '19 at 09:17
  • yes followed all steps and done the manual installation too. – Mayuresh Patil Jul 15 '19 at 09:27
  • There are 2 issues on the github page with the same issue you have. Could you check them out and see if it fixes the issue? https://github.com/react-native-community/react-native-image-picker/issues/563 https://github.com/react-native-community/react-native-image-picker/issues/845 – Rik Jul 15 '19 at 09:32
  • yes followed all the solutions given there but not solved my problem – Mayuresh Patil Jul 15 '19 at 09:48

1 Answers1

2

You should add the permissions in the correct AndroidManifest.xml. Add the required permissions inside android/app/src/main/AndroidManifest.xml and not in any other AndroidManifest.xml

Try adding it to the following path android/app/src/AndroidManifest.xml

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
Mahesh Jadhav
  • 1,091
  • 1
  • 8
  • 13