uCrop icon indicating copy to clipboard operation
uCrop copied to clipboard

No implementation found for boolean com.gjmm.parent.crop.task.BitmapCropTask.cropCImg

Open gjmm123 opened this issue 2 years ago • 3 comments

最后调用cropAndSaveImage方法时提示No implementation found for boolean com.gjmm.parent.crop.task.BitmapCropTask.cropCImg(java.lang. String, java.lang. String, int, int, int, int, float, float, int, int, int, int) (tried Java_com_gjmm_parent_crop_task_BitmapCropTask_cropCImg and Java_com_gjmm_parent_crop_task_BitmapCropTask_cropCImg__Ljava_lang_String_2Ljava_lang_String_2IIIIFFIIII),why?

gjmm123 avatar Nov 19 '21 10:11 gjmm123

I have spent almost hours and hours to figure this problem, at last, I found a solution for it:

I have shifted this library module to another module in my project and I removed this below line at initially it was giving error so I thought It's not needed then removed

public class BitmapCropTask extends AsyncTask<Void, Void, Throwable> {

   private static final String TAG = "BitmapCropTask";
   
   //Don't drop below lines It's mandatory
   static {
       System.loadLibrary("ucrop");
   }
   
   ....

Later on, I realized that I removed these lines so I reverted back and It works fine.

With this line, It loads the script which is placed in the Jni directory so If It's not loaded then it throws this error.

shahzadafridi avatar Dec 06 '21 10:12 shahzadafridi

Have any one solved this issue. I want to customize the cropper. But I have the same issue. I think its due to package name?

mans17312 avatar Jan 03 '22 06:01 mans17312

So, finally I found the culprit!

In my case I copied all of the files of the library to a module (To change the UI a bit and remove startActivityForResult() ) and renamed the module to other than "com.yalantis.ucrop".

While Cropping the image, this library picks up the function cropCImg(...) from a "C++" file named uCrop.cpp located in jni folders and in that file the header .h file and the function is defined as JNIEXPORT jboolean JNICALL Java_com_yalantis_ucrop_task_BitmapCropTask_cropCImg. These files are shown in the image.

Issue Since my module was renamed so it did not find the function "Java_com_yalantis_ucrop_task_BitmapCropTask_cropCImg".

Screenshot 2022-09-01 044104

Resolution:

  1. Either change the names from "com_yalantis_ucrop" to your own module name e.g. "com_something_something" in the header com_yalantis_ucrop_task_BitmapCropTask.h and uCrop.cpp file.
  2. OR rename the the module name back to "com.yalantis.ucrop".

Ehtisham95 avatar Aug 31 '22 23:08 Ehtisham95