Может ли кто-нибудь помочь мне найти мою ошибку, я посмотрел на него, я не могу найти его, я пытаюсь запустить свой код, но он продолжает давать мне ошибка java.lang.UnsatisfiedLinkError: Native method not found: nemo.lungu.receiptor.scanlibrary.ScanActivity.getPoints:(Landroid/graphics/Bitmap;)[F
ниже мой метод деятельности getPoints()
:java.lang.UnsatisfiedLinkError: родной метод не найден в Android
public native float[] getPoints(Bitmap bitmap);
версия заголовка метода getPoints()
:
JNIEXPORT jfloatArray JNICALL Java_nemo_lungu_receiptor_scanlibrary_ScanActivity_getPoints
(JNIEnv *, jobject, jobject);
и, наконец, реализация метода getPoints()
в моем .cpp
файле:
JNIEXPORT jfloatArray JNICALL Java_nemo_lungu_receiptor_scanlibrary_ScanActivity_getPoints
(JNIEnv *env, jobject thiz,jobject bitmap)
{
__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "Scaning getPoints");
int ret;
AndroidBitmapInfo info;
void* pixels = 0;
if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
__android_log_print(ANDROID_LOG_VERBOSE, APPNAME,"AndroidBitmap_getInfo() failed ! error=%d", ret);
return 0;
}
if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888)
{ __android_log_print(ANDROID_LOG_VERBOSE, APPNAME,"Bitmap format is not RGBA_8888!");
return 0;
}
if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
__android_log_print(ANDROID_LOG_VERBOSE, APPNAME,"AndroidBitmap_lockPixels() failed ! error=%d", ret);
}
// init our output image
Mat mbgra(info.height, info.width, CV_8UC4, pixels);
vector<Point> img_pts = getPoints(mbgra);
jfloatArray jArray = env->NewFloatArray(8);
if (jArray != NULL)
{
jfloat *ptr = env->GetFloatArrayElements(jArray, NULL);
for (int i=0,j=i+4; j<8; i++,j++)
{
ptr[i] = img_pts[i].x;
ptr[j] = img_pts[i].y;
}
env->ReleaseFloatArrayElements(jArray, ptr, NULL);
}
AndroidBitmap_unlockPixels(env, bitmap);
return jArray;
}
Am загрузки библиотеки, как:
static {
System.loadLibrary("myLibraryName");
}
который, кажется, успешно сработал, поскольку это дает мне сообщение Added shared lib /data/app-lib/nemo.lungu.receiptor-2/myLibraryName.so 0xa4fe5e78
но снова после того, что он дает мне еще одно сообщение, чтобы сказать No JNI_OnLoad found in /data/app-lib/nemo.lungu.receiptor-2/myLibraryName.so 0xa4fe5e78, skipping init
так Я не знаю, является ли это причиной или чем-то еще.