Dhaval2404/ImagePicker

Ucrop crash

harloom opened this issue · 3 comments

 ImagePicker.with(this@FromProyekActivity)
        .galleryOnly()    //User can only select image from Gallery
        .cropSquare()
        .compress(1024)
        .start { resultCode, data ->
            if (resultCode == Activity.RESULT_OK) {
                val fileUri = data?.data
                if (fileUri != null) {
                    mViewmodel.renderUpload(fileUri)
                }

                //You can get File object from intent
                val file: File? = ImagePicker.getFile(data)

                //You can also get File Path from intent
                val filePath: String? = ImagePicker.getFilePath(data)
            } else if (resultCode == ImagePicker.RESULT_ERROR) {
                Toast.makeText(
                    this@FromProyekActivity,
                    ImagePicker.getError(data),
                    Toast.LENGTH_SHORT
                ).show()
            } else {
                Toast.makeText(
                    this@FromProyekActivity,
                    "Task Cancelled",
                    Toast.LENGTH_SHORT
                )
                    .show()
            }

        }
Error Code : 
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.zerojump.a18app, PID: 14965
    java.lang.NoSuchMethodError: No virtual method start(Landroid/app/Activity;I)V in class Lcom/yalantis/ucrop/UCrop; or its super classes (declaration of 'com.yalantis.ucrop.UCrop' appears in /data/app/com.zerojump.a18app-to7xY13CNXQhLWgsLJMHvg==/base.apk!classes3.dex)
        at com.github.dhaval2404.imagepicker.provider.CropProvider.cropImage(CropProvider.kt:91)
        at com.github.dhaval2404.imagepicker.provider.CropProvider.startIntent(CropProvider.kt:61)
        at com.github.dhaval2404.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:116)
        at com.github.dhaval2404.imagepicker.provider.GalleryProvider.handleResult(GalleryProvider.kt:104)
        at com.github.dhaval2404.imagepicker.provider.GalleryProvider.onActivityResult(GalleryProvider.kt:89)
        at com.github.dhaval2404.imagepicker.ImagePickerActivity.onActivityResult(ImagePickerActivity.kt:97)
        at android.app.Activity.dispatchActivityResult(Activity.java:7741)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4724)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4773)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2034)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:226)
        at android.app.ActivityThread.main(ActivityThread.java:7179)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)

@harloom I'm looking into the issue now.
Thank you so much for the feedback. Your feedback helps me to make the app bug free.

@harloom I'm able to reproduce the issue with uCrop 2.2.4.

Can you please downgrade uCrop to v2.2.2 and try again.

implementation 'com.github.yalantis:ucrop:2.2.2'

@harloom Have you tried downgrading uCrop version? does it work for you?