ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.12k stars 1.56k forks source link

[Android] Taking and saving pictures fails #378

Open dtmzr opened 7 years ago

dtmzr commented 7 years ago

Version

Platform

Expected behaviour

Picking or taking one image, cropping it and saving it's path to redux which is combined with redux-persist.

Actual behaviour

Picking one image and cropping works fine. Whenever I want to take a picture and crop it the app 'resets/reloads' after cropping and runs out of memory.

More infos

Steps to reproduce

  1. use ImagePicker.openCamera()
  2. Take picture and save
  3. Crop and confirm

Attachments

{
  cropperActiveWidgetColor: '#91B6FF',
  cropperCircleOverlay: true,
  cropperStatusBarColor: '#91B6FF',
  cropperToolbarColor: '#91B6FF',
  cropping: true,
  height: 300,
  hideBottomControls: true,
  loadingLabelText: 'Verarbeite Daten...',
  mediaType: 'photo',
  showCropGuidelines: false,
  showsSelectedCount: false,
  smartAlbums: ['UserLibrary', 'PhotoStream'],
  width: 300,
}

07-17 13:38:07.312 7139-7249/com.testapp I/BitmapCropTask: Should crop: true 07-17 13:38:07.312 7139-7249/com.testapp D/uCrop JNI: Crop image with CImg 07-17 13:38:07.332 7139-7139/com.testapp I/UCropActivity: Mutate() is not supported for older platform - Therefore, override color resource (ucrop_color_toolbar_widget) in your app to make it work on pre-L devices 07-17 13:38:10.975 7139-7139/com.testapp D/Activity: performCreate Call secproduct feature valuefalse 07-17 13:38:10.975 7139-7139/com.testapp D/Activity: performCreate Call debug elastic valuetrue 07-17 13:38:10.985 7139-7139/com.testapp D/image-crop-picker: Skipping image compression 07-17 13:38:10.995 7139-7139/com.testapp D/SensorManager: registerListener :: 0, K330 3-axis Accelerometer, 66667, 0,
07-17 13:38:10.995 7139-7288/com.testapp W/unknown:PackagerConnectionSettings: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device. 07-17 13:38:10.995 7139-7303/com.testapp W/unknown:PackagerConnectionSettings: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device. 07-17 13:38:11.156 7139-7139/com.testapp I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@37231ab0 time:172336074 07-17 13:38:12.857 7139-7161/com.testapp I/art: Background sticky concurrent mark sweep GC freed 32975(3MB) AllocSpace objects, 6(96KB) LOS objects, 6% free, 54MB/58MB, paused 9.246ms total 116.851ms 07-17 13:38:15.139 7139-7161/com.testapp I/art: Background partial concurrent mark sweep GC freed 34704(4MB) AllocSpace objects, 7(19MB) LOS objects, 31% free, 34MB/50MB, paused 9.918ms total 228.149ms 07-17 13:38:22.747 7139-12158/com.testapp W/libc: pthread_create failed: couldn't allocate 1064960-byte stack: Out of memory 07-17 13:38:22.757 7139-12158/com.testapp E/art: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" 07-17 13:38:22.757 7139-12158/com.testapp E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher Process: com.testapp, PID: 7139 java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again at java.lang.Thread.nativeCreate(Native Method) at java.lang.Thread.start(Thread.java:1063) at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:920) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1338) at okhttp3.ConnectionPool.put(ConnectionPool.java:135) at okhttp3.OkHttpClient$1.put(OkHttpClient.java:149) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:188) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) at okhttp3.RealCall.access$100(RealCall.java:33) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) 07-17 13:38:22.817 7139-7139/com.testapp D/SensorManager: unregisterListener ::
07-17 13:38:22.917 7139-11507/com.testapp W/libc: pthread_create failed: couldn't allocate 1064960-byte stack: Out of memory 07-17 13:38:22.917 7139-11507/com.testapp E/art: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" 07-17 13:38:22.927 7139-11508/com.testapp W/libc: pthread_create failed: couldn't allocate 1064960-byte stack: Out of memory 07-17 13:38:22.927 7139-11508/com.testapp E/art: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" 07-17 13:38:22.927 7139-11508/com.testapp W/libc: pthread_create failed: couldn't allocate 1064960-byte stack: Out of memory 07-17 13:38:22.927 7139-11508/com.testapp E/art: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" 07-17 13:38:22.927 7139-11508/com.testapp I/Process: Sending signal. PID: 7139 SIG: 9

Ps. I'm 600m away from your companies location, any time up for fixing this together!

ivpusic commented 7 years ago

thanks for reporting this. I see OutOfMemoryError error. Would be cool if you have some time to check if we can somehow avoid OutOfMemoryError.

marlti7 commented 7 years ago

in andorid, need use localpath to save picture

dtmzr commented 7 years ago

@marlti7 sorry for the late response but what do you mean by that? Like I said picking images works fine in android, it only crashes when I try to take a picture first.

dgurns commented 7 years ago

I'm also getting this issue -- app restarts after taking picture.

sabbyt54 commented 6 years ago

+1

sandropoluan commented 6 years ago

+1. App restarts after taking picture but works fine when picking image.

kwes01 commented 6 years ago

I have this problem when I take a photo from the camera imagen

this is my function

openCamera() { ImagePicker.openCamera({ width: 300, height: 300, cropping: true, cropperCircleOverlay: true, compressImageMaxWidth: 640, compressImageMaxHeight: 480, compressImageQuality: 0.5, compressVideoPreset: 'MediumQuality', includeExif: true, }) .then((image) => { console.log('received image', image); this.setState({ profilePciture: { uri: image.path, width: image.width, height: image.height, mime: image.mime, }, }); }) .catch((e) => { console.log(e); Alert.alert(e.message ? e.message : e); }); }

adnkh commented 6 years ago

I'm also having this issue, Is there any way to handle this error temporary asking the user to select another image if it is so big to fit in memory?.

arifinoid commented 4 years ago

Same here, this issue still occurs on low device android

akhilsanker commented 4 years ago

Hi, Facing the issue.

@adnkh @arifinoid Any workaround found?

Thanks

b3hz4d commented 3 years ago

I have this problem when I take a photo from the camera imagen

this is my function

openCamera() { ImagePicker.openCamera({ width: 300, height: 300, cropping: true, cropperCircleOverlay: true, compressImageMaxWidth: 640, compressImageMaxHeight: 480, compressImageQuality: 0.5, compressVideoPreset: 'MediumQuality', includeExif: true, }) .then((image) => { console.log('received image', image); this.setState({ profilePciture: { uri: image.path, width: image.width, height: image.height, mime: image.mime, }, }); }) .catch((e) => { console.log(e); Alert.alert(e.message ? e.message : e); }); }

This issue is not solved after 3 years yet !!!!