ndk调用.so的第三方库出问题jni
接口函数是:char* RealRaptorDecoder(repair_symbol* RcvSymbols,unsigned short RcvNumber,unsigned short K,unsigned int T,unsigned short N)
其中的结构体类型为:
typedef struct symbol
{
unsigned short ESI; 符号id
unsigned char* DATA; 符号值
}repair_symbol;
在java里面对应的类是:
public class Symbol
{
public short ESI;
public String DATA;
}
在cpp文件中写的是:
JNIEXPORT jstring JNICALL Java_test_test_Jni_RealRaptorDecoder
(JNIEnv *env, jobject thiz, jobjectArray RcvSymbols, jshort RcvNumber, jshort K, jint T, jshort N)
{
raptor r1;
jclass objectClass = env->GetObjectClass(RcvSymbols);
jfieldID ESI = env->GetFieldID(objectClass,"ESI","I");
jshort jESI = (jshort)env->GetObjectField(RcvSymbols,ESI);
jfieldID DATA = env->GetFieldID(objectClass,"DATA","Ljava/lang/String")
jstring jDATA = (jstring)env->GetObjectField(RcvSymbols,DATA);
return stoJstring(env,r1.RealRaptorDecoder(objectClass,RcvNumber,K,T,N));
}
jstring stoJstring(JNIEnv* env, const char* pat)
{
jclass strClass = env->FindClass("Ljava/lang/String;");
jmethodID ctorID = env->GetMethodID(strClass, "<init>", "([BLjava/lang/String;)V");
jbyteArray bytes = env->NewByteArray(strlen(pat));
env->SetByteArrayRegion(bytes, 0, strlen(pat), (jbyte*)pat);
jstring encoding = env->NewStringUTF("utf-8");
return (jstring)env->NewObject(strClass, ctorID, bytes, encoding);
}
报的错是:
05-10 14:18:41.810: E/AndroidRuntime(6680): java.lang.ExceptionInInitializerError
05-10 14:18:41.810: E/AndroidRuntime(6680): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]: 1584 cannot locate '_ZN9bitMatrix9bm_rowXorEttttP13BitMatrix_Tag'...
还有一些跟这个类似的错误。
求助~~ 谢谢!!~~
不知我哪里写的有问题呢??~~~
--------------------编程问答-------------------- 在logcat里应该有提示是哪一行出的错 你跟踪下看看 --------------------编程问答-------------------- 错误就是报在systemload那里~~
补充:移动开发 , Android