Open gjmm123 opened 2 years ago
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.
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?
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".
Resolution:
com_yalantis_ucrop_task_BitmapCropTask.h
and uCrop.cpp
file.
最后调用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?