shijingsh / react-native-customized-image-picker

iOS/Android image picker with support for camera, video compression, multiple images and cropping
245 stars 59 forks source link

Please help me #75

Open ram3919 opened 4 years ago

ram3919 commented 4 years ago

when I try to open camera,in openPicker my app is getting crash without log. Please provide me any solution.

ImagePicker.openPicker({ multiple: true, isCamera:true, maxSize:5, multipleShot:true }).then(image => { resolve(image) })

liukefu2050 commented 4 years ago

add permission:

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

change buildToolsVersion: android { compileSdkVersion 28 buildToolsVersion "28.0.3" }

ram3919 commented 4 years ago

i have already tried with this.but this is not a solution. i'm using react native version 0.61

liukefu2050 commented 4 years ago

react-native-customized-image-picker/pickerExample, Can it be normal? or check whether your app have camera permission in system settings

sundeep51652 commented 4 years ago

Hi, I got the solution, please check your Logcat in android studio. if you are getting this error (Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=30850, uid=10299 requires android.permission.WRITE_EXTERNAL_STORAGE)

then just request for the permission for WRITE_EXTERNAL_STORAGE before opening camera.

example: async handleCamera() { try { const results = await PermissionsAndroid.requestMultiple([ PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, PermissionsAndroid.PERMISSIONS.CAMERA ]);

  if (
    results[PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE] ===
      "granted" &&
    results[PermissionsAndroid.PERMISSIONS.CAMERA] === "granted"
  ) {
    ImagePicker.openCamera(CAMERA_PROPS).then(fileObj => {

    });
  } else {
    console.log("Camera permission denied");
  }
} catch (err) {
  console.warn(err);
}

}

MostafaMAbdellateif commented 4 years ago

I found out that this is happening when using react-native-fast-image with it, check if this is happening with you also, i don't have a solution to make them work together thou

Anujmoglix commented 4 years ago

most time app get crashed . no proper solution .

anhquan291 commented 3 years ago

most time app get crashed . no proper solution .

Same issue here. Any help please. Thanks

liukefu2050 commented 3 years ago

can do some validation

  1. Is the picture big

  2. Whether the image format is correct and whether the file suffix has been modified

  3. Is it an empty file

  4. Whether it is a compressed file. If the compressed parameter has been used, a compressed file will be generated. The name is:*_compressed,In this case, it can be used ImagePicker.clean () to clear up

YMalikk commented 2 years ago

This package crash on Android 11 , i resolve this problem by : Adding imageLoader: 'UNIVERSAL' to openPicker params