CropImageActivity stuck on loading after choosing image from image picker.
I am using CropImage.activity()
.setGuidelines(CropImageView.Guidelines.ON)
.start(this); but it gets stuck in the crop activity after I choose the image. Is that a bug or something?
can you reproduce the issue in the sample app?
I'm facing the same problem.
This is how I initialize the cropper:
CropImage.activity()
.setGuidelines(CropImageView.Guidelines.ON)
.setRequestedSize(DEFAULT_GROUPPIC_SIZE, DEFAULT_GROUPPIC_SIZE, CropImageView.RequestSizeOptions.RESIZE_INSIDE)
.setBackgroundColor(context.getResources().getColor(R.color.colorBlackOpacity50))
.setCropShape(CropImageView.CropShape.RECTANGLE)
.setBorderLineColor(context.getResources().getColor(R.color.colorPrimary))
.setGuidelinesColor(context.getResources().getColor(R.color.colorAccent))
.setFixAspectRatio(true)
.setAspectRatio(1,1)
.setBorderLineColor(context.getResources().getColor(R.color.colorPrimary))
.start(this);
This is the stack that works: MainActivity > Activity 1 > Cropper.
This is the stack that doesn't work: MainActivity > Activity 1 > Activity 2 > Cropper.
It take the photo on the camera, but when it cames to the cropping function, it keeps loading.
This is my onActivityResult:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
CropImage.ActivityResult result = CropImage.getActivityResult(data);
if (resultCode == RESULT_OK) {
Uri resultUri = result.getUri();
...
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError();
Log.e(TAG, "onActivityResult: " + error);
}
}
}
But it doesn't arrive on the onActivityResult. I've seen the logcat and no error is shown there.
This is the only logs that I have (from the moment I start the CropImage.activity()) :
08-30 19:08:06.341 1546-2013/? I/ActivityManager: START u0 {cmp=com.apitadorv2.app/com.theartofdev.edmodo.cropper.CropImageActivity (has extras)} from uid 10094 on display 0
08-30 19:08:06.444 6695-7399/com.apitadorv2.app D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=CreateGroupActivity, firebase_previous_id(_pi)=-8435086739872438876, firebase_screen_class(_sc)=CropImageActivity, firebase_screen_id(_si)=-8435086739872438872}]
08-30 19:08:06.555 3852-7401/? V/FA-SVC: Logging event: origin=auto,name=screen_view(_vs),params=Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=CreateGroupActivity, firebase_previous_id(_pi)=-8435086739872438876, firebase_screen_class(_sc)=CropImageActivity, firebase_screen_id(_si)=-8435086739872438872}]
08-30 19:08:06.570 3852-7401/? V/FA-SVC: Event recorded: Event{appId='com.apitadorv2.app', name='screen_view(_vs)', params=Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=CreateGroupActivity, firebase_previous_id(_pi)=-8435086739872438876, firebase_screen_class(_sc)=CropImageActivity, firebase_screen_id(_si)=-8435086739872438872}]}
08-30 19:08:09.328 6025-7427/? I/CAM_OneCamCreator: Picture Size Configuration: PictureSizeCalculator.Configuration{native size=640x480, crop=Rect(0, 0 - 640, 480)}
08-30 19:08:09.732 1546-1566/? I/WindowManager: Destroying surface Surface(name=com.apitadorv2.app/com.theartofdev.edmodo.cropper.CropImageActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.AppWindowAnimator.stepAnimationLocked:427 com.android.server.wm.WindowAnimator.updateAppWindowsLocked:176 com.android.server.wm.WindowAnimator.animateLocked:678
@ArthurHub if you need more information, let me know, please.
How can I reproduce the "MainActivity > Activity 1 > Activity 2 > Cropper" flow?
Same happens with me in one plus 3t phone.Doesn't happen in any other phone(I haven't tested lot of other phones.- tested with xiaomi mi 3,moto 3g n many other phones)
Same happens to me here using elephone p8000 to run my apps.. though i have not yet tried other phones via running d app.
This is how it happens to me... It allows me to pick Image... After picking the image as it tries loading thecropImage activity, it crash
Happens to me on a Redmi Note 3 =(
But the sample and quick start sample does work..
To fix this issue, edit CropImageView.java at line 958.
Where you see:
mBitmapLoadingWorkerTask.get().execute();
Replace with:
mBitmapLoadingWorkerTask.get().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Basically you need to replace every .execute() on the library with .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
I was able to solve mine... Just add to your app dependence
compile 'com.android.support:exifinterface:26.+
Make sure your comileSdkVersion is 26 if you are to use 26.+
added executor fix in 2.5.1